Skip to content

Commit 52ece13

Browse files
authored
Merge pull request #296 from coderefinery/rantahar-autodoc-to-md
Replace instructions in step 2 with a pure markdown solution
2 parents e384bda + 5f14d74 commit 52ece13

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

content/sphinx.md

+13-18
Original file line numberDiff line numberDiff line change
@@ -357,30 +357,25 @@ def multiply(a: float, b: float) -> float:
357357
return a * b
358358
```
359359
360-
2. Add a file `api.md` in the same folder as `index.rst`, with the following content:
361-
````md
362-
# API reference
363-
364-
## example
360+
2. In the file `conf.py` modify "extensions" and add 3 lines:
361+
```python
362+
extensions = ['myst_parser', "autodoc2"]
365363
366-
```{eval-rst}
367-
.. automodule:: example
368-
:members:
364+
autodoc2_packages = [
365+
"multiply.py"
366+
]
369367
```
370-
````
371368
372-
3. In the file `conf.py` add 3 lines and modify "extensions":
373-
```python
374-
# this is a trick to make sphinx find the modules in the parent directory
375-
import os
376-
import sys
377-
sys.path.insert(0, os.path.abspath("."))
369+
4. List `apidocs/index` in the toctree in `index.rst`.
370+
```rst
371+
.. toctree::
372+
:maxdepth: 2
373+
:caption: Contents:
378374
379-
extensions = ['myst_parser', "sphinx.ext.autodoc"]
375+
some-feature.md
376+
apidocs/index
380377
```
381378
382-
4. List the `api.md` file in `index.rst`.
383-
384379
5. Re-build the documentation and check the "API reference" section.
385380
`````
386381

0 commit comments

Comments
 (0)