Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bf24b0d

Browse files
committedJul 5, 2022
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)
Please sign in to comment.