Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace instructions in step 2 with a pure markdown solution #296

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 13 additions & 18 deletions content/sphinx.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,30 +357,25 @@ def multiply(a: float, b: float) -> float:
return a * b
```

2. Add a file `api.md` in the same folder as `index.rst`, with the following content:
````md
# API reference

## example
2. In the file `conf.py` modify "extensions" and add 3 lines:
```python
extensions = ['myst_parser', "sphinx.ext.autodoc"]
rantahar marked this conversation as resolved.
Show resolved Hide resolved

```{eval-rst}
.. automodule:: example
:members:
autodoc2_packages = [
"multiply.py"
]
```
rantahar marked this conversation as resolved.
Show resolved Hide resolved
````

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("."))
4. List `apidocs/index` in the toctree in `index.rst`.
```rst
.. toctree::
:maxdepth: 2
:caption: Contents:

extensions = ['myst_parser', "sphinx.ext.autodoc"]
some-feature.md
apidocs/index
```

4. List the `api.md` file in `index.rst`.

5. Re-build the documentation and check the "API reference" section.
`````

Expand Down
Loading