| 1 |
Documentation Formats |
| 2 |
===================== |
| 3 |
|
| 4 |
The following sections roughly documents the supported docstrings formatting. |
| 5 |
|
| 6 |
As an additional reference, small python packages demonstrates how docstrings are rendered. |
| 7 |
|
| 8 |
.. toctree:: |
| 9 |
:maxdepth: 1 |
| 10 |
|
| 11 |
epytext |
| 12 |
restructuredtext |
| 13 |
google-numpy |
| 14 |
|
| 15 |
Choose your docstring format with the option:: |
| 16 |
|
| 17 |
--docformat=<format> |
| 18 |
|
| 19 |
The following format keywords are recognized: |
| 20 |
|
| 21 |
- ``epytext`` |
| 22 |
- ``restructuredtext`` |
| 23 |
- ``google`` |
| 24 |
- ``numpy`` |
| 25 |
- ``plaintext`` |
| 26 |
|
| 27 |
To override the default markup language for a module, define a module-level string variable |
| 28 |
``__docformat__``, containing the name of the module's markup language:: |
| 29 |
|
| 30 |
__docformat__ = "reStructuredText" |
| 31 |
__docformat__ = "Epytext" |
| 32 |
|
| 33 |
.. note:: Language code can be added. It is currently ignored, though it might be used it |
| 34 |
the future to generate ``lang`` attribute in HTML or as configuration for a spell checker:: |
| 35 |
|
| 36 |
__docformat__ = "reStructuredText en" |
| 37 |
|
| 38 |
Parser name and language code are **case insensitve**. |
| 39 |
|
| 40 |
If a package defines ``__docformat__`` in its ``__init__.py`` file, all modules (including subpackages) in that package will inherit its value. |