File tree 1 file changed +13
-18
lines changed
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:
357
357
return a * b
358
358
```
359
359
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"]
365
363
366
- ```{eval-rst}
367
- .. automodule:: example
368
- :members:
364
+ autodoc2_packages = [
365
+ "multiply.py"
366
+ ]
369
367
```
370
- ````
371
368
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:
378
374
379
- extensions = ['myst_parser', "sphinx.ext.autodoc"]
375
+ some-feature.md
376
+ apidocs/index
380
377
```
381
378
382
- 4. List the `api.md` file in `index.rst`.
383
-
384
379
5. Re-build the documentation and check the "API reference" section.
385
380
`````
386
381
You can’t perform that action at this time.
0 commit comments