Skip to content

Commit 6d0f5fd

Browse files
add api reference to documentation using sphinx-autodoc2 (#115)
1 parent a077c02 commit 6d0f5fd

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/django_twc_package/docs/conf.py.jinja

+6-2
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ author = "{{ author_name }}"
4040
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
4141
# ones.
4242
extensions = [
43+
"autodoc2",
4344
"myst_parser",
4445
"sphinx_copybutton",
4546
"sphinx_inline_tabs",
46-
"sphinx.ext.autodoc",
4747
"sphinx.ext.napoleon",
4848
]
4949

@@ -59,10 +59,14 @@ exclude_patterns = []
5959
# -- MyST configuration ------------------------------------------------------
6060
myst_heading_anchors = 3
6161

62+
# -- Options for autodoc2 -----------------------------------------------------
63+
autodoc2_packages = [f"../src/{project.replace('-', '_')}"]
64+
autodoc2_render_plugin = "myst"
65+
66+
# -- Options for sphinx_copybutton -----------------------------------------------------
6267
copybutton_selector = "div.copy pre"
6368
copybutton_prompt_text = "$ "
6469

65-
6670
# -- Options for HTML output -------------------------------------------------
6771

6872
# The theme to use for HTML and HTML Help pages. See the documentation for

src/django_twc_package/docs/index.md renamed to src/django_twc_package/docs/index.md.jinja

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
```
44

5+
```{toctree}
6+
:hidden:
7+
:maxdepth: 3
8+
:caption: API Reference
9+
10+
apidocs/{{ module_name }}/{{ module_name }}.rst
11+
```
12+
513
```{toctree}
614
:hidden:
715
:maxdepth: 3

src/django_twc_package/pyproject.toml.jinja

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ docs = [
6060
"myst-parser",
6161
"sphinx",
6262
"sphinx-autobuild",
63+
"sphinx-autodoc2",
6364
"sphinx-copybutton",
6465
"sphinx-inline-tabs"
6566
]

0 commit comments

Comments
 (0)