@@ -19,29 +19,31 @@ suggested format for script documentation can be divided into three parts.
1919
2020- A brief description of the script.
2121- Detailed description.
22- - Tutorials.
22+ - Tutorials and deprecated/experimental marks .
2323
2424To separate these from each other, the documentation comments use special tags.
25- The tag must be at the beginning of a line (ignoring preceding white space) and must
26- have the format ``@ ``, followed by the keyword, and finishing with a colon .
25+ The tag must be at the beginning of a line (ignoring preceding white space)
26+ and must have the format ``@ ``, followed by the keyword.
2727
2828Tags
2929~~~~
3030
3131+-------------------+--------------------------------------------------------+
32- | Brief description | No tag and lives at the very beginning of |
32+ | Brief description | No tag. Lives at the very beginning of |
3333| | the documentation section. |
3434+-------------------+--------------------------------------------------------+
35- | Description | Use one blank line to separate the description from |
36- | | the brief. |
35+ | Description | No tag. Use one blank line to separate the description |
36+ | | from the brief. |
3737+-------------------+--------------------------------------------------------+
3838| Tutorial | | ``@tutorial: `` |
3939| | | ``@tutorial(The Title Here): `` |
4040+-------------------+--------------------------------------------------------+
41+ | Deprecated | ``@deprecated `` |
42+ +-------------------+--------------------------------------------------------+
43+ | Experimental | ``@experimental `` |
44+ +-------------------+--------------------------------------------------------+
4145
42- For example:
43-
44- ::
46+ For example::
4547
4648 extends Node2D
4749 ## A brief description of the class's role and functionality.
@@ -51,6 +53,7 @@ For example:
5153 ##
5254 ## @tutorial: https://the/tutorial1/url.com
5355 ## @tutorial(Tutorial2): https://the/tutorial2/url.com
56+ ## @experimental
5457
5558.. warning ::
5659
@@ -66,16 +69,6 @@ For example:
6669Documenting script members
6770--------------------------
6871
69- Documentation of a script member must immediately precede the member or its
70- annotations if it has any. The exception to this is enum values whose description should
71- be on the same line as the enum for readability.
72- The description can have more than one line but every line must start
73- with the double hash symbol ``## `` to be considered as part of the documentation.
74- The script documentation will update in the editor help window every time the
75- script is updated. If any member variable or function name starts with an
76- underscore, it will be treated as private. It will not appear in the documentation and
77- will be ignored in the help window.
78-
7972Members that are applicable for documentation:
8073
8174- Inner class
@@ -86,8 +79,48 @@ Members that are applicable for documentation:
8679- Enum
8780- Enum value
8881
89- Example
90- -------
82+ Documentation of a script member must immediately precede the member or its annotations
83+ if it has any. The description can have more than one line but every line must start with
84+ the double hash symbol ``## `` to be considered as part of the documentation.
85+
86+ Tags
87+ ~~~~
88+
89+ +--------------+-------------------+
90+ | Description | No tag. |
91+ +--------------+-------------------+
92+ | Deprecated | ``@deprecated `` |
93+ +--------------+-------------------+
94+ | Experimental | ``@experimental `` |
95+ +--------------+-------------------+
96+
97+ For example::
98+
99+ ## The description of the variable.
100+ ## @deprecated
101+ var my_var
102+
103+ Variables, constants, signals, and enum values support inline documentation comments.
104+ Note that inline comments do not support tags.
105+
106+ ::
107+
108+ var my_var ## My variable.
109+ const MY_CONST = 1 ## My constant.
110+ signal my_signal ## My signal.
111+ enum Direction {
112+ UP = 0, ## Direction up.
113+ DOWN = 1, ## Direction down.
114+ LEFT = 2, ## Direction left.
115+ RIGHT = 3, ## Direction right.
116+ }
117+
118+ The script documentation will update in the editor help window every time the script is updated.
119+ If any member variable or function name starts with an underscore, it will be treated as private.
120+ It will not appear in the documentation and will be ignored in the help window.
121+
122+ Complete script example
123+ -----------------------
91124
92125::
93126
@@ -99,20 +132,24 @@ Example
99132 ##
100133 ## @tutorial: https://the/tutorial1/url.com
101134 ## @tutorial(Tutorial2): https://the/tutorial2/url.com
135+ ## @experimental
102136
103137 ## The description of a constant.
104138 const GRAVITY = 9.8
105139
106140 ## The description of a signal.
107141 signal my_signal
108142
109- ## This is a description of the below enums. Note below that
110- ## the enum values are documented on the same line as the enum.
143+ ## This is a description of the below enum.
111144 enum Direction {
112- UP = 0, ## Direction up.
113- DOWN = 1, ## Direction down.
114- LEFT = 2, ## Direction left.
115- RIGHT = 3, ## Direction right.
145+ ## Direction up.
146+ UP = 0,
147+ ## Direction down.
148+ DOWN = 1,
149+ ## Direction left.
150+ LEFT = 2,
151+ ## Direction right.
152+ RIGHT = 3,
116153 }
117154
118155 ## The description of a constant.
@@ -149,6 +186,7 @@ Example
149186 ## immediately precede the class definition.
150187 ##
151188 ## @tutorial: https://the/tutorial/url.com
189+ ## @experimental
152190 class Inner:
153191
154192 ## Inner class variable v4.
@@ -158,6 +196,24 @@ Example
158196 ## Inner class function fn.
159197 func fn(): pass
160198
199+ ``@deprecated `` and ``@experimental `` tags
200+ ------------------------------------------
201+
202+ You can mark a class or any of its members as deprecated or experimental.
203+ This will add the corresponding indicator in the built-in documentation viewer.
204+ This can be especially useful for plugin and library creators.
205+
206+ .. image :: img/deprecated_and_experimental_marks.webp
207+
208+ - **Deprecated ** marks a non-recommended API that is subject to removal or incompatible change
209+ in a future major release. Usually the API is kept for backwards compatibility.
210+ - **Experimental ** marks a new unstable API that may be changed or removed in the current
211+ major branch. Using this API is not recommended in production code.
212+
213+ .. note ::
214+
215+ While technically you can use both ``@deprecated `` and ``@experimental `` tags on the same
216+ class/member, this is not recommended as it is against common conventions.
161217
162218BBCode and class reference
163219--------------------------
0 commit comments