Zack Williams | 7f708f8 | 2020-07-07 12:18:20 -0700 | [diff] [blame] | 1 | Documentation Guide |
| 2 | =================== |
| 3 | |
| 4 | Writing Documentation |
| 5 | --------------------- |
| 6 | |
Zack Williams | 34c30e5 | 2020-11-16 10:55:00 -0700 | [diff] [blame] | 7 | Docs are generated using :doc:`Sphinx <sphinx:usage/index>`. |
Zack Williams | 7f708f8 | 2020-07-07 12:18:20 -0700 | [diff] [blame] | 8 | |
Zack Williams | 34c30e5 | 2020-11-16 10:55:00 -0700 | [diff] [blame] | 9 | Documentation is written in :doc:`reStructuredText |
| 10 | <sphinx:usage/restructuredtext/basics>`. |
Zack Williams | 7f708f8 | 2020-07-07 12:18:20 -0700 | [diff] [blame] | 11 | |
| 12 | In reStructuredText documents, to create the section hierarchy (mapped in HTML |
| 13 | to ``<h1>`` through ``<h5>``) use these characters to underline headings in the |
| 14 | order given: ``=``, ``-`` ``"``, ``'``, ``^``. |
| 15 | |
Zack Williams | 34c30e5 | 2020-11-16 10:55:00 -0700 | [diff] [blame] | 16 | Referencing other Documentation |
| 17 | ------------------------------- |
| 18 | |
| 19 | Other Sphinx-built documentation, both ONF and non-ONF can be linked to using |
| 20 | :doc:`Intersphinx <sphinx:usage/extensions/intersphinx>`. |
| 21 | |
| 22 | You 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 Williams | 7f708f8 | 2020-07-07 12:18:20 -0700 | [diff] [blame] | 26 | Building the Docs |
| 27 | ------------------ |
| 28 | |
| 29 | The documentation build process is stored in the ``Makefile``. Building docs |
| 30 | requires Python to be installed, and most steps will create a virtualenv |
| 31 | (``venv_docs``) which contains the required tools. You may also need to |
| 32 | install the ``enchant`` C library using your system's package manager for the |
| 33 | spelling checker to function properly. |
| 34 | |
| 35 | Run ``make html`` to generate html documentation in ``_build/html``. |
| 36 | |
| 37 | To check the formatting of documentation, run ``make lint``. This will be done |
| 38 | in Jenkins to validate the documentation, so please do this before you create a |
| 39 | patchset. |
| 40 | |
| 41 | To check spelling, run ``make spelling``. If there are additional words that |
| 42 | are correctly spelled but not in the dictionary (acronyms, trademarks, etc.) |
| 43 | please add them to the ``dict.txt`` file. |
| 44 | |
| 45 | Creating new Versions of Docs |
| 46 | ----------------------------- |
| 47 | |
| 48 | To change the version shown on the built site, change the contents of the |
| 49 | ``VERSION`` file. |
| 50 | |
| 51 | There is a ``make multiversion`` target which will build all versions published |
| 52 | on the remote to ``_build``. This will use a fork of `sphinx-multiversion |
| 53 | <https://github.com/Holzhaus/sphinx-multiversion>`_ to build multiple versions |
| 54 | for the site. |
| 55 | |
| 56 | Creating Graphs and Diagrams |
| 57 | ---------------------------- |
| 58 | |
| 59 | Multiple tools are available to render inline text-based graphs definitions and |
| 60 | diagrams within the documentation. This is preferred over images as it's easier |
| 61 | to change and see changes over time as a diff. |
| 62 | |
Zack Williams | 34c30e5 | 2020-11-16 10:55:00 -0700 | [diff] [blame] | 63 | :doc:`Graphviz <sphinx:usage/extensions/graphviz>` supports many standard graph |
| 64 | types. |
Zack Williams | 7f708f8 | 2020-07-07 12:18:20 -0700 | [diff] [blame] | 65 | |
| 66 | The `blockdiag <http://blockdiag.com/en/blockdiag/sphinxcontrib.html>`_, |
| 67 | `nwdiag, and rackdiag <http://blockdiag.com/en/nwdiag/sphinxcontrib.html>`_, |
| 68 | and `seqdiag <http://blockdiag.com/en/seqdiag/sphinxcontrib.html>`_ suites of |
| 69 | tools 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 | |
| 76 | The styles applied to nodes and connections in these diagrams can be customized |
| 77 | using `attributes |
| 78 | <http://blockdiag.com/en/blockdiag/attributes/node.attributes.html>`_. |