summaryrefslogtreecommitdiffstats
path: root/editor
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2022-08-06 20:48:54 +0300
committerYuri Sizov <yuris@humnom.net>2022-08-08 22:18:38 +0300
commit35c1eae8d70eb6ae49495339b95f89bcd084c3f2 (patch)
tree5058f5211a4f3d2b56d157dfd49e482299c64b9c /editor
parent9b19a02f319c73762b5a25f91a44256e764f8d8e (diff)
downloadredot-engine-35c1eae8d70eb6ae49495339b95f89bcd084c3f2.tar.gz
Add support for [param foo] syntax in valid documentation contexts
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_help.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 5c3038c468..8d58469684 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -1803,6 +1803,21 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
p_rt->pop();
pos = brk_end + 1;
+ } else if (tag.begins_with("param ")) {
+ const int tag_end = tag.find(" ");
+ const String param_name = tag.substr(tag_end + 1, tag.length()).lstrip(" ");
+
+ // Use monospace font with translucent background color to make code easier to distinguish from other text.
+ p_rt->push_font(doc_code_font);
+ p_rt->push_bgcolor(Color(0.5, 0.5, 0.5, 0.15));
+ p_rt->push_color(code_color);
+ p_rt->add_text(param_name);
+ p_rt->pop();
+ p_rt->pop();
+ p_rt->pop();
+
+ pos = brk_end + 1;
+
} else if (doc->class_list.has(tag)) {
// Class reference tag such as [Node2D] or [SceneTree].
// Use monospace font with translucent colored background color to make clickable references