blob: 2e1bdd0beb95732ce76d094b955d3c6cb8375b64 [file] [log] [blame]
Zack Williams98fe2322021-09-20 15:02:11 -07001Documentation Guide
2===================
3
4Writing Documentation
5---------------------
6
7Docs are generated using :doc:`Sphinx <sphinx:usage/index>`.
8
9Documentation is written in :doc:`reStructuredText
10<sphinx:usage/restructuredtext/basics>` - see this link for the basic format.
11
12In reStructuredText documents, to create the section hierarchy (mapped in HTML
13to ``<h1>`` through ``<h5>``) use these characters to underline headings in the
14order given: ``=``, ``-`` ``"``, ``'``, ``^``.
15
16Referencing other Documentation
17-------------------------------
18
19Other Sphinx-built documentation, both ONF and non-ONF can be linked to using
20:doc:`Intersphinx <sphinx:usage/extensions/intersphinx>`.
21
22You can see all link targets available on a remote Sphinx's docs by running::
23
24 python -msphinx.ext.intersphinx http://otherdocs/objects.inv
25
26Building the Docs
27------------------
28
29The documentation build process is stored in the ``Makefile``. Building docs
30requires Python to be installed, and most steps will create a virtualenv
31(``venv_docs``) which contains the required tools. You may also need to
32install the ``enchant`` C library using your system's package manager for the
33spelling checker to function properly.
34
35Run ``make html`` to generate html documentation in ``_build/html``.
36
37To check the formatting of documentation, run ``make lint``. This will be done
38in Jenkins to validate the documentation, so please do this before you create a
39patchset.
40
41To check spelling, run ``make spelling``. If there are additional words that
42are correctly spelled but not in the dictionary (acronyms, trademarks, etc.)
43please add them to the ``dict.txt`` file.
44
45Creating new Versions of Docs
46-----------------------------
47
48To change the version shown on the built site, change the contents of the
49``VERSION`` file.
50
51There is a ``make multiversion`` target which will build all versions published
52on the remote to ``_build``. This will use `sphinx-multiversion
53<https://github.com/Holzhaus/sphinx-multiversion>`_ to build multiple versions
54of the site.
55
56Adding Images and Diagrams
57--------------------------
58
59There are multiple ways to add images and diagrams to the documentation.
60Generally, you should prefer using `SVG
61<https://en.wikipedia.org/wiki/Scalable_Vector_Graphics>`_ images, as these can
62be scaled to any size without quality loss.
63
64If you're creating diagrams, there are multiple tools available.
65:doc:`Graphviz <sphinx:usage/extensions/graphviz>` can render inline text-based
66graphs definitions and diagrams within the documentation, and is best for
67simple diagrams.
68
69More complex diagrams can be created in `Diagrams.net/Draw.io
70<https://www.diagrams.net/>`_ format. When saving these diagrams, use the
71SVG format, and check the "Include a copy of my diagram". This will let
72someone open the SVG later directly from the documentation and edit it, without
73any loss in functionality or quality.
74
75The last resort is to use raster images. If they're drawings or screen
76captures, use the `PNG
77<https://en.wikipedia.org/wiki/Portable_Network_Graphics>`_ format. Consider
78compressing them with a tool like `OptiPNG <http://optipng.sourceforge.net/>`_,
79or `pngquant <https://pngquant.org/>`_. If it's a photograph, use `JPEG
80<https://en.wikipedia.org/wiki/JPEG>`_.