1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Add Markdown syntax highlighting to the script editor

This commit is contained in:
Hugo Locurcio
2023-06-07 19:18:41 +02:00
parent 9425535602
commit 3eb8b0ac8c
2 changed files with 68 additions and 0 deletions

View File

@@ -120,6 +120,24 @@ public:
EditorJSONSyntaxHighlighter() { highlighter.instantiate(); }
};
class EditorMarkdownSyntaxHighlighter : public EditorSyntaxHighlighter {
GDCLASS(EditorMarkdownSyntaxHighlighter, EditorSyntaxHighlighter)
private:
Ref<CodeHighlighter> highlighter;
public:
virtual void _update_cache() override;
virtual Dictionary _get_line_syntax_highlighting_impl(int p_line) override { return highlighter->get_line_syntax_highlighting(p_line); }
virtual PackedStringArray _get_supported_languages() const override { return PackedStringArray{ "md", "markdown" }; }
virtual String _get_name() const override { return TTR("Markdown"); }
virtual Ref<EditorSyntaxHighlighter> _create() const override;
EditorMarkdownSyntaxHighlighter() { highlighter.instantiate(); }
};
///////////////////////////////////////////////////////////////////////////////
class ScriptEditorQuickOpen : public ConfirmationDialog {