Skip to content

Commit

Permalink
Revert, committed to the wrong branch
Browse files Browse the repository at this point in the history
  • Loading branch information
rantahar authored Sep 18, 2024
1 parent 27656fa commit e384bda
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions content/sphinx.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,25 +357,30 @@ def multiply(a: float, b: float) -> float:
return a * b
```
2. In the file `conf.py` modify "extensions" and add 3 lines:
```python
extensions = ['myst_parser', "sphinx.ext.autodoc"]
2. Add a file `api.md` in the same folder as `index.rst`, with the following content:
````md
# API reference
## example
autodoc2_packages = [
"multiply.py"
]
```{eval-rst}
.. automodule:: example
:members:
```
````
4. List `apidocs/index` in the toctree in `index.rst`.
```rst
.. toctree::
:maxdepth: 2
:caption: Contents:
3. In the file `conf.py` add 3 lines and modify "extensions":
```python
# this is a trick to make sphinx find the modules in the parent directory
import os
import sys
sys.path.insert(0, os.path.abspath("."))
some-feature.md
apidocs/index
extensions = ['myst_parser', "sphinx.ext.autodoc"]
```
4. List the `api.md` file in `index.rst`.
5. Re-build the documentation and check the "API reference" section.
`````

Expand Down

0 comments on commit e384bda

Please sign in to comment.