blob: d77f72656b9e0558bb23330629abdc60d4b1a0eb [file] [log] [blame]
Zack Williams7f708f82020-07-07 12:18:20 -07001Documentation Guide
2===================
3
4Writing Documentation
5---------------------
6
Zack Williams34c30e52020-11-16 10:55:00 -07007Docs are generated using :doc:`Sphinx <sphinx:usage/index>`.
Zack Williams7f708f82020-07-07 12:18:20 -07008
Zack Williams34c30e52020-11-16 10:55:00 -07009Documentation is written in :doc:`reStructuredText
10<sphinx:usage/restructuredtext/basics>`.
Zack Williams7f708f82020-07-07 12:18:20 -070011
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
Zack Williams34c30e52020-11-16 10:55:00 -070016Referencing 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
Zack Williams7f708f82020-07-07 12:18:20 -070026Building 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 a fork of `sphinx-multiversion
53<https://github.com/Holzhaus/sphinx-multiversion>`_ to build multiple versions
54for the site.
55
56Creating Graphs and Diagrams
57----------------------------
58
59Multiple tools are available to render inline text-based graphs definitions and
60diagrams within the documentation. This is preferred over images as it's easier
61to change and see changes over time as a diff.
62
Zack Williams34c30e52020-11-16 10:55:00 -070063:doc:`Graphviz <sphinx:usage/extensions/graphviz>` supports many standard graph
64types.
Zack Williams7f708f82020-07-07 12:18:20 -070065
66The `blockdiag <http://blockdiag.com/en/blockdiag/sphinxcontrib.html>`_,
67`nwdiag, and rackdiag <http://blockdiag.com/en/nwdiag/sphinxcontrib.html>`_,
68and `seqdiag <http://blockdiag.com/en/seqdiag/sphinxcontrib.html>`_ suites of
69tools can be used to create specific types of diagrams:
70
71- `blockdiag examples <http://blockdiag.com/en/blockdiag/examples.html>`_
72- `nwdiag examples <http://blockdiag.com/en/nwdiag/nwdiag-examples.html>`_
73- `rackdiag examples <http://blockdiag.com/en/nwdiag/rackdiag-examples.html>`_
74- `seqdiag examples <http://blockdiag.com/en/seqdiag/examples.html>`_
75
76The styles applied to nodes and connections in these diagrams can be customized
77using `attributes
78<http://blockdiag.com/en/blockdiag/attributes/node.attributes.html>`_.