Skip to content

Commit bf24b0d

Browse files
committed
Add reST syntax to docstrings as an example
1 parent 3ca4fac commit bf24b0d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

β€ŽREADME.rstβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ This example shows the following basic integration with Read the Docs. You're en
99
Read the Docs Build configuration is stored in ``.readthedocs.yaml`` (configuration-as-code)
1010
πŸ“ `docs/requirements.txt <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/docs/requirements.txt>`_ and `docs/requirements.in <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/docs/requirements.in>`_
1111
Python dependencies are `pinned <https://docs.readthedocs.io/en/latest/guides/reproducible-builds.html>`_ (uses `pip-tools <https://pip-tools.readthedocs.io/en/latest/>`_)
12+
πŸ’‘ `docs/api.rst <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/docs/api.rst>`_
13+
By listing the Python module ``lumache`` in ``autosummary``, Sphinx will automatically scan this module and generate API docs.
1214
πŸ’‘ `lumache.py <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/lumache.py>`_
13-
Auto-generated API docs for an example Python module, uses your *docstrings* directly in documentation
15+
API docs are generated for this example Python module - they use *docstrings* directly in the documentation, notice how this shows up in the rendered documentation.
1416
πŸ”’ Git tags versioning
1517
A basic versioning mechanism with git tags.
1618
πŸ“œ `README.rst <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/README.rst>`_

β€Žlumache.pyβ€Ž

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
"""
22
Lumache - Python library for cooks and food lovers.
3+
4+
This is a Python docstring, we can use reStructuredText syntax here!
5+
6+
.. code-block:: python
7+
8+
# Import lumache
9+
import lumache
10+
11+
# Call its only function
12+
get_random_ingredients(kind=["cheeses"])
313
"""
414

515
__version__ = "0.1.0"

0 commit comments

Comments
Β (0)