|
@@ -259,6 +259,52 @@ Ref<EditorSyntaxHighlighter> EditorJSONSyntaxHighlighter::_create() const {
|
|
return syntax_highlighter;
|
|
return syntax_highlighter;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+////
|
|
|
|
+
|
|
|
|
+void EditorMarkdownSyntaxHighlighter::_update_cache() {
|
|
|
|
+ highlighter->set_text_edit(text_edit);
|
|
|
|
+ highlighter->clear_keyword_colors();
|
|
|
|
+ highlighter->clear_member_keyword_colors();
|
|
|
|
+ highlighter->clear_color_regions();
|
|
|
|
+
|
|
|
|
+ // Disable automatic symbolic highlights, as these don't make sense for prose.
|
|
|
|
+ highlighter->set_symbol_color(EDITOR_GET("text_editor/theme/highlighting/text_color"));
|
|
|
|
+ highlighter->set_number_color(EDITOR_GET("text_editor/theme/highlighting/text_color"));
|
|
|
|
+ highlighter->set_member_variable_color(EDITOR_GET("text_editor/theme/highlighting/text_color"));
|
|
|
|
+ highlighter->set_function_color(EDITOR_GET("text_editor/theme/highlighting/text_color"));
|
|
|
|
+
|
|
|
|
+ // Headings (any level).
|
|
|
|
+ const Color function_color = EDITOR_GET("text_editor/theme/highlighting/function_color");
|
|
|
|
+ highlighter->add_color_region("#", "", function_color);
|
|
|
|
+
|
|
|
|
+ // Bold.
|
|
|
|
+ highlighter->add_color_region("**", "**", function_color);
|
|
|
|
+ // `__bold__` syntax is not supported as color regions must begin with a symbol,
|
|
|
|
+ // not a character that is valid in an identifier.
|
|
|
|
+
|
|
|
|
+ // Code (both inline code and triple-backticks code blocks).
|
|
|
|
+ const Color code_color = EDITOR_GET("text_editor/theme/highlighting/engine_type_color");
|
|
|
|
+ highlighter->add_color_region("`", "`", code_color);
|
|
|
|
+
|
|
|
|
+ // Link (both references and inline links with URLs). The URL is not highlighted.
|
|
|
|
+ const Color link_color = EDITOR_GET("text_editor/theme/highlighting/keyword_color");
|
|
|
|
+ highlighter->add_color_region("[", "]", link_color);
|
|
|
|
+
|
|
|
|
+ // Quote.
|
|
|
|
+ const Color quote_color = EDITOR_GET("text_editor/theme/highlighting/string_color");
|
|
|
|
+ highlighter->add_color_region(">", "", quote_color, true);
|
|
|
|
+
|
|
|
|
+ // HTML comment, which is also supported in Markdown.
|
|
|
|
+ const Color comment_color = EDITOR_GET("text_editor/theme/highlighting/comment_color");
|
|
|
|
+ highlighter->add_color_region("<!--", "-->", comment_color);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+Ref<EditorSyntaxHighlighter> EditorMarkdownSyntaxHighlighter::_create() const {
|
|
|
|
+ Ref<EditorMarkdownSyntaxHighlighter> syntax_highlighter;
|
|
|
|
+ syntax_highlighter.instantiate();
|
|
|
|
+ return syntax_highlighter;
|
|
|
|
+}
|
|
|
|
+
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
/*** SCRIPT EDITOR ****/
|
|
/*** SCRIPT EDITOR ****/
|
|
@@ -4331,6 +4377,10 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
|
|
json_syntax_highlighter.instantiate();
|
|
json_syntax_highlighter.instantiate();
|
|
register_syntax_highlighter(json_syntax_highlighter);
|
|
register_syntax_highlighter(json_syntax_highlighter);
|
|
|
|
|
|
|
|
+ Ref<EditorMarkdownSyntaxHighlighter> markdown_syntax_highlighter;
|
|
|
|
+ markdown_syntax_highlighter.instantiate();
|
|
|
|
+ register_syntax_highlighter(markdown_syntax_highlighter);
|
|
|
|
+
|
|
_update_online_doc();
|
|
_update_online_doc();
|
|
}
|
|
}
|
|
|
|
|