@@ -28,8 +28,21 @@ Ideally, software documentation should include:
2828- ** Explanations** to convey deeper understanding of why and how the software
2929 operates the way it does.
3030
31- This overall framework has a name, [ Diátaxis] [ ] , and you can read more about it
32- if you are interested.
31+ {: .note-title }
32+
33+ > The Diátaxis framework
34+ >
35+ > This overall framework has a name, [ Diátaxis] [ ] , and you can read more about
36+ > it if you are interested.
37+
38+ <!-- [[[cog
39+ from cog_helpers import render_cookie
40+ with render_cookie() as package:
41+ docs_conf_py = package.joinpath("docs/conf.py").read_text(encoding="utf-8").strip()
42+ docs_index_md = package.joinpath("docs/index.md").read_text(encoding="utf-8").strip()
43+ readthedocs_yaml = package.joinpath(".readthedocs.yml").read_text(encoding="utf-8").strip()
44+ ]]] -->
45+ <!-- [[[end]]] -->
3346
3447## Hand-written docs
3548
@@ -40,15 +53,21 @@ is our recommended starting point for `conf.py`:
4053
4154### conf.py
4255
56+ <!-- prettier-ignore-start -->
57+ <!-- [[[cog
58+ print("```python")
59+ print(docs_conf_py)
60+ print("```")
61+ ]]] -->
4362``` python
4463from __future__ import annotations
4564
4665import importlib.metadata
4766
48- project = " < package-name-here> "
49- copyright = " 2023, Your Name"
50- author = " Your Name"
51- version = release = importlib.metadata.version(" < package-name-here> " )
67+ project = " package"
68+ copyright = " 2023, My Name"
69+ author = " My Name"
70+ version = release = importlib.metadata.version(" package" )
5271
5372extensions = [
5473 " myst_parser" ,
@@ -60,33 +79,35 @@ extensions = [
6079 " sphinx_copybutton" ,
6180]
6281
63- source_suffix = [" .md " , " .rst " ]
82+ source_suffix = [" .rst " , " .md " ]
6483exclude_patterns = [
6584 " _build" ,
85+ " **.ipynb_checkpoints" ,
6686 " Thumbs.db" ,
6787 " .DS_Store" ,
68- " **.ipynb_checkpoints" ,
6988 " .env" ,
7089 " .venv" ,
7190]
7291
7392html_theme = " furo"
7493
75- intersphinx_mapping = {
76- " python" : (" https://docs.python.org/3" , None ),
77- }
78-
7994myst_enable_extensions = [
8095 " colon_fence" ,
8196]
8297
98+ intersphinx_mapping = {
99+ " python" : (" https://docs.python.org/3" , None ),
100+ }
101+
83102nitpick_ignore = [
84103 (" py:class" , " _io.StringIO" ),
85104 (" py:class" , " _io.BytesIO" ),
86105]
87106
88107always_document_param_types = True
89108```
109+ <!-- [[[end]]] -->
110+ <!-- prettier-ignore-end -->
90111
91112We start by setting some configuration values, but most notably we are getting
92113the package version from the installed version of your package. We are listing
@@ -132,12 +153,18 @@ docstrings, even if the parameter isn't documented yet. Feel free to check
132153[ sphinx-autodoc-typehints] ( https://github.com/tox-dev/sphinx-autodoc-typehints )
133154for more options.
134155
135- ## index.md
156+ ### index.md
136157
137158Your ` index.md ` file can start out like this:
138159
160+ <!-- prettier-ignore-start -->
161+ <!-- [[[cog
162+ print("````md")
163+ print(docs_index_md)
164+ print("````")
165+ ]]] -->
139166```` md
140- # Project name
167+ # package
141168
142169``` {toctree}
143170:maxdepth: 2
@@ -155,6 +182,8 @@ Your `index.md` file can start out like this:
155182- {ref}` modindex `
156183- {ref}` search `
157184````
185+ <!-- [[[end]]] -->
186+ <!-- prettier-ignore-end -->
158187
159188You can put your project name in as the title. The ` toctree ` directive houses
160189your table of contents; you'll list each new page you add inside that directive.
@@ -191,6 +220,12 @@ plugins and try to build against an uninstalled version of your project.
191220In order to use < https://readthedocs.org > to build, host, and preview your
192221documentation, you must have a ` .reathedocs.yml ` file {% rr RTD100 %} like this:
193222
223+ <!-- prettier-ignore-start -->
224+ <!-- [[[cog
225+ print("```yaml")
226+ print(readthedocs_yaml)
227+ print("```")
228+ ]]] -->
194229``` yaml
195230# Read the Docs configuration file
196231# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
@@ -201,7 +236,6 @@ build:
201236 os : ubuntu-22.04
202237 tools :
203238 python : " 3.11"
204-
205239sphinx :
206240 configuration : docs/conf.py
207241
@@ -212,6 +246,8 @@ python:
212246 extra_requirements :
213247 - docs
214248` ` `
249+ <!-- [[[end]]] -->
250+ <!-- prettier-ignore-end -->
215251
216252This sets the readthedocs config version (2 is required) {% rr RTD101 %}.
217253
0 commit comments