@@ -227,13 +227,32 @@ Notice that if the definition of the function gets updated, this
227
227
section needs to be updated too.
228
228
229
229
230
- Example Docstrings
231
- ==================
232
- Methods and functions should generally be documented within the
233
- 'Examples' section to make the usage of the method or function clear.
234
- Here is a sample function :
230
+ Additional Directives
231
+ =====================
232
+ Since Python docstrings are written using RST syntax, it is possible to take
233
+ advantage of some directives available in this Markup language. Among those, it
234
+ is possible to find :
235
235
236
- .. literalinclude :: sample_func.py
236
+ - ``.. note:: `` directive is useful for highlighting important
237
+ information once the documentation gets rendered.
238
+
239
+ - ``.. warning:: `` is usually used to point out an action that might result in
240
+ data loss.
241
+
242
+ - ``.. deprecated:: X.Y.Z `` to inform the user about the deprecated status of
243
+ the object or functionality.
244
+
245
+ You can find additional information and examples at `numpydoc `_. Reference
246
+ this documentation as the primary source regarding docstring styles for directives
247
+ that are not covered here.
248
+
249
+
250
+ Example
251
+ =======
252
+
253
+ An generic docstring example compliant with PyAnsys guidelines is shown below:
254
+
255
+ .. literalinclude :: code/sample_func.py
237
256
238
257
To include the docstring of a function within Sphinx, you use the
239
258
``autofunction:: `` directive:
@@ -246,13 +265,5 @@ This directive renders the sample function as:
246
265
247
266
.. autofunction :: pyansys_sphinx_theme.sample_func.func
248
267
249
- Additional Information
250
- ======================
251
- You can find additional information and examples at `numpydoc `_. Reference
252
- this documentation as the primary source regarding docstring styles for directives
253
- that are not covered here. For example, you use the ``note:: `` directive to highlight
254
- important information and the ``warning:: `` directive to point out an action that
255
- might result in data loss.
256
-
257
268
.. _numpydoc : https://numpydoc.readthedocs.io/en/latest/format.html
258
269
.. _googledoc : https://google.github.io/styleguide/
0 commit comments