File tree Expand file tree Collapse file tree 1 file changed +13
-18
lines changed
Expand file tree Collapse file tree 1 file changed +13
-18
lines changed Original file line number Diff line number Diff 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-
3843795. Re-build the documentation and check the "API reference" section.
385380`````
386381
You can’t perform that action at this time.
0 commit comments