Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Markdown syntax highlighting to the script editor #78312

Merged

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Jun 16, 2023

There are some limitations due to how CodeEdit's highlighting works, but it's good enough for a lot of Markdown files out there already. It could be made significantly better if add_color_region() had a way to enforce the start to be at the beginning of a line, or with only leading whitespace 🙂

Preview

Screenshot_20230616_080330

Screenshot_20230616_080339

Screenshot_20230616_080430

Screenshot_20230616_080452

@yoont4
Copy link

yoont4 commented Mar 19, 2024

Just curious, is there any issue with 4.x compatibility on this PR? Would love to see this in an upcoming release!

@Calinou
Copy link
Member Author

Calinou commented Mar 19, 2024

Just curious, is there any issue with 4.x compatibility on this PR? Would love to see this in an upcoming release!

To my knowledge, there's nothing blocking this PR, but it needs a review. Since GDC is ongoing and many core contributors are there, this may take a while.

@yoont4
Copy link

yoont4 commented Mar 20, 2024

To my knowledge, there's nothing blocking this PR, but it needs a review. Since GDC is ongoing and many core contributors are there, this may take a while.

Ah that makes total sense, thanks for the reply!

Comment on lines +259 to +283
// `__bold__` syntax is not supported as color regions must begin with a symbol,
// not a character that is valid in an identifier.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this because the script editor assumes that's GDScript?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's because of #30586 (which still seems to partially exist in 4.x, at least for _).

@adamscott adamscott modified the milestones: 4.x, 4.3 Jun 11, 2024
@akien-mga akien-mga modified the milestones: 4.3, 4.x Jun 28, 2024
@justin-carver
Copy link

Is this still pending review? Would love to have this feature natively.

Copy link
Member

@coppolaemilio coppolaemilio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is such an easy merge, looking forward to it 💖

@timothyqiu
Copy link
Member

Some valid markdown might have incorrect highlighting.

image

Text
Autolink is URL between `<` and `>`. See <https://www.example.com/> for details.

Most inline <abbr title="Hypertext Markup Language">HTML</abbr> tags are supported.

We can probably just highlight the > at the beginning of a line.

@Calinou
Copy link
Member Author

Calinou commented Oct 22, 2024

We can probably just highlight the > at the beginning of a line.

CodeHighligher.add_color_region() doesn't have a way to make a region effective only if it starts at the beginning of the line, so this would have to be implemented first.

@Repiteo Repiteo modified the milestones: 4.x, 4.4 Oct 23, 2024
@Repiteo Repiteo merged commit fd75707 into godotengine:master Oct 24, 2024
18 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Oct 24, 2024

Thanks!

@Calinou Calinou deleted the editor-add-markdown-highlighting branch October 24, 2024 20:57
@mrfisty
Copy link

mrfisty commented Nov 23, 2024

Excited for this as well!

@FrostMiKu
Copy link

Is it possible to export this SyntaxHighlighter to a GDScript class?
I think it would be useful for writing editor programs. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for editing manual/tutorial Markdown files in the script editor
10 participants