Skip to content

Commit c23e5e6

Browse files
authored
Improving the docs-build instructions (#2143)
1 parent 22c1135 commit c23e5e6

File tree

1 file changed

+44
-36
lines changed

1 file changed

+44
-36
lines changed

doc/developer/documenting.rst

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,29 @@ Documenting ARMI
55
****************
66

77
ARMI uses the `Sphinx <https://www.sphinx-doc.org/en/master/>`_ documentation system to compile the
8-
web-based documentation from in-code docstrings and hand-created
8+
ARMI documentation into HTML and PDF from in-code docstrings and hand-created
99
`ReStructedText files <https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html>`_.
1010
This provides several benefits:
1111

12-
* We can revise and track the documentation in lock-step with the code itself, in the same
13-
source code repository
14-
* We can make use of hyperlinked cross-references that stay up to date as the code is expanded
15-
or refactored.
16-
* We can run specific code tests during documentation building to ensure the documentation
17-
examples remain valid
12+
* We can revise and track the documentation in lock-step with the code itself, in the same source
13+
code repository
14+
* We can make use of hyperlinked cross-references that stay up to date as the code is expanded or
15+
refactored.
16+
* We can run specific code tests during documentation building to ensure the documentation examples
17+
remain valid
1818
* We can auto-generate class diagrams based on the latest status of the code
19+
* Every Pull Request (PR) generates HTML and PDF versions of the documentation for the PR Author and
20+
Reviewer
1921

2022
We use some special Sphinx plugins that run the tutorial jupyter notebooks during documentation
21-
build with the most up-to-date code.
23+
build with the most up-to-date code.
2224

23-
Building the documentation
25+
Building the Documentation
2426
==========================
2527
Before building documentation, ensure that you have installed the documentation requirements into
26-
your ARMI virtual environment with::
28+
your ARMI virtual environment with:
29+
30+
.. code-block:: bash
2731
2832
pip install -e .[docs]
2933
@@ -32,40 +36,41 @@ You also need to have the following utilities available in your PATH:
3236
* `Graphviz <https://graphviz.org/>`_
3337
* `Pandoc <https://pandoc.org/>`_
3438

35-
If you want to build the documentation into a PDF using the Sphinx LaTeX
36-
builder, you also need:
39+
If you want to build the documentation into a PDF using the Sphinx LaTeX builder, you also need:
3740

3841
* LaTeX (`MikTeX <https://miktex.org/>`_ on Windows)
3942
* `ImageMagick <https://imagemagick.org/>`_
4043

41-
The documentation depends on at least one submodule as well, so you must be sure
42-
it is available in your source tree with::
44+
The documentation depends on at least one submodule as well, so you must be sure it is available in
45+
your source tree with:
46+
47+
.. code-block:: bash
4348
4449
git submodule update --init
4550
4651
47-
To build the ARMI documentation as html, go to the ``doc`` folder and run::
52+
To build the ARMI documentation as html, go to the ``doc`` folder and run:
53+
54+
.. code-block:: bash
4855
4956
make html
5057
51-
This will invoke Sphinx and generate a series of html files in the
52-
``_build/html`` folder. Open up ``index.html`` to see the documentation from
53-
there. A copy of the documentation is hosted online at
58+
This will invoke Sphinx and generate a series of html files in the ``_build/html`` folder. Open up
59+
``index.html`` to see the documentation from there. A copy of the documentation is hosted online at
5460
https://terrapower.github.io/armi/.
5561

56-
You can suggest a change to the built documentation by copying the ``_build``
57-
files to a clone of the `documentation repository
58-
<https://github.com/terrapower/terrapower.github.io>`_ with a command like::
59-
60-
rsync -ahv --delete _build/html/ path/to/terrapower.github.io/armi
62+
You can suggest a change to the documentation by opening an ARMI PR.
6163

6264
Documentation for ARMI plugins
6365
==============================
6466
The following subsections apply to documentation for ARMI plugins.
6567

6668
Linking to ARMI documentation from plugins
6769
------------------------------------------
68-
ARMI plugin documentation can feature rich hyperlinks to the ARMI API documentation with the help of the `intersphinx Sphinx plugin <http://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html>`_. The ARMI plugin documentation config file should add ``"sphinx.ext.intersphinx",`` to its active Sphinx plugin list, and change the default config to read::
70+
ARMI plugin documentation can feature rich hyperlinks to the ARMI API documentation with the help
71+
of the `intersphinx Sphinx plugin <http://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html>`_.
72+
The ARMI plugin documentation config file should add ``"sphinx.ext.intersphinx",`` to its active
73+
Sphinx plugin list, and change the default config to read::
6974

7075
intersphinx_mapping = {
7176
"python": ("https://docs.python.org/3", None),
@@ -80,27 +85,30 @@ Now you can link to the ARMI documentation with links like::
8085

8186
Automatically building apidocs of namespace packages
8287
----------------------------------------------------
83-
Activating the ``"sphinxcontrib.apidoc",`` `Sphinx plugin <https://github.com/sphinx-contrib/apidoc>`_ enables plugin API documentation to be built with the standard ``make html`` Sphinx workflow. If your ARMI plugin is a namespace package, the following extra config is required::
88+
Activating the ``"sphinxcontrib.apidoc",`` `Sphinx plugin <https://github.com/sphinx-contrib/apidoc>`_
89+
enables plugin API documentation to be built with the standard ``make html`` Sphinx workflow. If your
90+
ARMI plugin is a namespace package, the following extra config is required::
8491

8592
apidoc_extra_args = ["--implicit-namespaces"]
8693

8794
Updating the Gallery
8895
====================
8996
The `ARMI example gallery <https://terrapower.github.io/armi/gallery/index.html>`_ is a great way
9097
to quickly highlight neat features and uses of ARMI. To add a new item to the gallery, add your
91-
example code (including the required docstring) to the ``doc/gallery-src`` folder in the ARMI
92-
source tree. The example will be added to the gallery during the next documentation build.
98+
example code (including the required docstring) to the ``doc/gallery-src`` folder in the ARMI source
99+
tree. The example will be added to the gallery during the next documentation build.
93100

94-
Using Jupyter notebooks
101+
Using Jupyter Notebooks
95102
=======================
96-
For interactive tutorials, it's convenient to build actual Jupyter notebooks and
97-
commit them to the documentation to be rendered by Sphinx using the nbsphinx plugin.
98-
When this is done, notebooks without any output should be committed to the repository
99-
so that Sphinx actually executes the notebooks with the up-to-date code when the
100-
documentation is built. To do this, you can clean the output with::
103+
For interactive tutorials, it's convenient to build actual Jupyter notebooks and commit them to the
104+
documentation to be rendered by Sphinx using the nbsphinx plugin. When this is done, notebooks
105+
without any output should be committed to the repository so that Sphinx actually executes the
106+
notebooks with the up-to-date code when the documentation is built. To do this, you can clean the
107+
output with:
101108

102-
jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace mynotebook.ipynb
109+
.. code-block:: bash
103110
104-
This should clear the output and overwrite the file. If this doesn't work, you can clear
105-
all output cells in the notebook web interface itself before committing the file.
111+
jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace mynotebook.ipynb
106112
113+
This should clear the output and overwrite the file. If this doesn't work, you can clear all output
114+
cells in the notebook web interface itself before committing the file.

0 commit comments

Comments
 (0)