Add Markdown syntax highlighting to the script editor
- Follow-up to https://github.com/godotengine/godot/pull/77972 (can be merged independently).
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 :slightly_smiling_face:
- This closes https://github.com/godotengine/godot-proposals/issues/1409.
Preview
Just curious, is there any issue with 4.x compatibility on this PR? Would love to see this in an upcoming release!
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.
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!
Is this still pending review? Would love to have this feature natively.
Some valid markdown might have incorrect highlighting.
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.
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.
Thanks!
Excited for this as well!
Is it possible to export this SyntaxHighlighter to a GDScript class? I think it would be useful for writing editor programs. Thank you!
Is it possible to export this SyntaxHighlighter to a GDScript class? I think it would be useful for writing editor programs. Thank you!
I believe this is already exposed to scripting in a way that editor plugins can provide their own highlighters. We may need more documentation for this in the class reference still, or perhaps even a dedicated manual page.