You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/contribute/documentation.md
+20-31Lines changed: 20 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,15 @@
1
1
# Writing documentation
2
2
3
-
All of the team's repositories are documented using [the Sphinx documentation engine](https://sphinx-doc.org).
4
-
This page contains resources to help you understand Sphinx and the configurations we commonly use in our repositories.
3
+
All of the team's repositories are documented using the [Sphinx] documentation engine.
4
+
This page contains resources to help you understand [Sphinx] and the configurations we commonly use in our repositories.
5
+
6
+
[Sphinx]: https://sphinx-doc.org
5
7
6
8
## MyST Markdown
7
9
8
-
Many of our repositories use [MyST Markdown](https://myst-parser.readthedocs.io).
10
+
Our repositories use [MyST Markdown](https://myst-parser.readthedocs.io).
9
11
This is enabled via the [`myst-parser` Sphinx extension](https://myst-parser.readthedocs.io).
10
12
11
-
## reStructuredText
12
-
13
-
The default markup language used by Sphinx is [reStructuredText](https://www.sphinx-doc.org/en/master/usage/restructuredtext/).
14
-
It is a rich and extensible way to write content for our documentation.
15
-
See [the Sphinx reStructuredText documentation](https://www.sphinx-doc.org/en/master/usage/restructuredtext/) for an in-depth guide of how to use it.
16
-
17
13
## Build documentation locally
18
14
19
15
There are a few ways to build the documentation in our repositories.
@@ -22,41 +18,35 @@ Here are a few common ways to do so, from most- to least-automated.
22
18
23
19
### Building with `nox`
24
20
25
-
We often use [the `nox` command line tool](https://nox.thea.codes/en/stable/) to build documentation locally.
21
+
We use [the `nox` command line tool](https://nox.thea.codes/en/stable/) to automate the build documentation locally.
26
22
`nox` is a tool for quickly running commands in an isolated build environment.
27
23
It is similar to `Make`, but with a Python configuration and with local build environments that are isolated to each job that you run.
28
24
29
25
`nox` is configured with [a file called `noxfile.py`](https://nox.thea.codes/en/stable/config.html).
30
26
31
-
**To install `nox`**, run this command:
27
+
**To install `nox`**, follow the [steps in Nox's documentation](https://nox.thea.codes/en/stable/tutorial.html#installation).
28
+
29
+
**To see a list of available commands**, run
32
30
33
31
```bash
34
-
pip install nox
32
+
nox -l
35
33
```
36
34
37
-
**To see a list of available commands**, run this command:
35
+
**To install the requirements for documentation, build them locally, and have a live preview**, run
38
36
39
37
```bash
40
-
nox -l
38
+
nox -s docs -- live
41
39
```
42
40
43
-
For example, we often name our documentation command `docs`.
44
-
**To install the requirements for documentation and build them locally**, run:
41
+
``````{note}
42
+
If you don't want the live preview, run
45
43
46
-
```
44
+
```bash
47
45
nox -s docs
48
46
```
49
47
50
48
This will place the built HTML files in `docs/_build/html` for you to inspect as you wish.
51
-
52
-
We often add an extra parameter to instead run a live server via [the `sphinx-autobuild` extension](https://github.com/executablebooks/sphinx-autobuild).
53
-
**To build docs with a live serve that auto-reloads as you change things**, run this command:
54
-
55
-
```
56
-
nox -s docs -- live
57
-
```
58
-
59
-
Note that this will **only work for repositories that have a `noxfile.py` added**.
49
+
``````
60
50
61
51
(docs:build-make)=
62
52
### Building with `Makefile`s
@@ -66,18 +56,17 @@ Many of our repositories also have a `Makefile` that runs commands in your curre
66
56
To do so, follow these steps:
67
57
68
58
1. Install the requirements for the documentation. This is often in a `docs/requirements.txt` file.
69
-
Assuming a file in this location, run this command:
59
+
Assuming a file in this location, run
70
60
71
61
```bash
72
62
pip install -r docs/requirements.txt
73
63
```
74
64
2. Look for a `Makefile` in the `docs` repository.
75
-
This is auto-generated by Sphinx to help you build the documentation.
76
-
To build the `html` for our documentation, run this command:
65
+
This is auto-generated by [Sphinx] to help you build the documentation.
66
+
To build the `html` for our documentation, run
77
67
78
68
```bash
79
-
cd docs
80
-
make html
69
+
make -C docs html
81
70
```
82
71
83
72
It will put the built documentation in `_build/html` (depending on our configuration this may change a bit).
0 commit comments