2024-08-22 23:56:43 +10:00
|
|
|
Writing documentation
|
|
|
|
|
=====================
|
2022-05-07 11:42:12 +10:00
|
|
|
|
2023-02-24 16:21:21 +11:00
|
|
|
A great way to contribute without writing code is to help writing
|
|
|
|
|
documentation. Please reach out before contributing as the software is still in
|
|
|
|
|
an alpha state and portions may not be worth documenting as it changes too
|
|
|
|
|
frequently.
|
|
|
|
|
|
2024-08-22 23:56:43 +10:00
|
|
|
Philosophy
|
|
|
|
|
----------
|
|
|
|
|
|
|
|
|
|
The documentation is split into three sections:
|
|
|
|
|
|
|
|
|
|
1. **Quickstart**: a crash course where a user should be able to go from
|
|
|
|
|
nothing to doing the most basic, common tasks. It is not comprehensive, but
|
|
|
|
|
a highly focused tutorial style "taster" of what's available. It should be
|
|
|
|
|
kept very short, aiming to acquaint new users within an hour.
|
|
|
|
|
2. **Guides**: a guidebook style, topic-driven series of articles discussing
|
|
|
|
|
things of interest, or tutorials that cover common workflows. This should
|
|
|
|
|
contain lots of images.
|
|
|
|
|
3. **Reference**: a comprehensive index of the entire interface and all
|
|
|
|
|
available features.
|
|
|
|
|
|
|
|
|
|
Documentation should not be a guide to IFC. Users should not have to know what
|
|
|
|
|
IFC is.
|
|
|
|
|
|
|
|
|
|
Official documentation should be polished and maintained. Less documentation of
|
|
|
|
|
a higher quality that is kept updated with every release is preferred to more
|
|
|
|
|
documentation with stubs, incomplete or inaccurate information.
|
|
|
|
|
|
|
|
|
|
Syntax
|
|
|
|
|
------
|
2023-02-24 16:21:21 +11:00
|
|
|
|
|
|
|
|
All documentation is written in ReStructured Text and is available in the
|
2024-08-22 21:02:19 +10:00
|
|
|
`Bonsai docs directory
|
|
|
|
|
<https://github.com/IfcOpenShell/IfcOpenShell/tree/v0.8.0/src/bonsai/docs>`_.
|
2024-03-30 17:37:14 +11:00
|
|
|
You can press the edit button on the top right on any documentation page to
|
|
|
|
|
quickly edit their content.
|
2023-02-24 16:21:21 +11:00
|
|
|
|
2024-06-21 10:54:05 +03:00
|
|
|
Links
|
|
|
|
|
^^^^^
|
|
|
|
|
|
|
|
|
|
You can link to
|
|
|
|
|
|
|
|
|
|
.. code-block:: restructuredtext
|
|
|
|
|
|
|
|
|
|
`external websites
|
|
|
|
|
<https://docs.readthedocs.io/en/stable/guides/cross-referencing-with-sphinx.html>`_
|
|
|
|
|
|
2024-05-08 22:26:46 +10:00
|
|
|
(note the space between the url and the link text). You can also link to
|
2024-06-21 10:54:05 +03:00
|
|
|
sections on the same page, like
|
|
|
|
|
|
|
|
|
|
.. code-block:: restructuredtext
|
|
|
|
|
|
|
|
|
|
:ref:`contribute/writing_docs:Writing technical documentation`
|
|
|
|
|
|
|
|
|
|
or with
|
|
|
|
|
|
|
|
|
|
.. code-block:: restructuredtext
|
|
|
|
|
|
|
|
|
|
:ref:`custom text<contribute/writing_docs:writing technical documentation>`.
|
|
|
|
|
|
|
|
|
|
Traditional references like
|
|
|
|
|
|
|
|
|
|
.. code-block:: restructuredtext
|
|
|
|
|
|
|
|
|
|
`Writing technical documentation`_
|
|
|
|
|
|
|
|
|
|
work too but are discouraged. You can link to other pages, like this:
|
|
|
|
|
|
|
|
|
|
.. code-block:: restructuredtext
|
|
|
|
|
|
|
|
|
|
:doc:`Hello World<hello_world>`
|
|
|
|
|
|
|
|
|
|
or sections within other pages, like this:
|
|
|
|
|
|
|
|
|
|
.. code-block:: restructuredtext
|
|
|
|
|
|
|
|
|
|
:ref:`devs/installation:unstable installation`
|
|
|
|
|
|
|
|
|
|
We have ``autosectionlabel`` enabled so it is not necessary to manually create labels. The depth of sections
|
2024-06-15 07:10:00 +03:00
|
|
|
with automatic labels is set to 2, so the third level of titles
|
|
|
|
|
will not get automatic labels to avoid duplication.
|
2023-09-07 18:11:55 +10:00
|
|
|
|
2024-06-21 10:54:05 +03:00
|
|
|
You can still create labels manually. This way you would ensure links still works when documentation is refactored.
|
|
|
|
|
|
|
|
|
|
.. code-block:: restructuredtext
|
|
|
|
|
|
|
|
|
|
.. _My label:
|
|
|
|
|
|
|
|
|
|
My Section
|
|
|
|
|
==========
|
|
|
|
|
|
|
|
|
|
:ref:`Link to My Section <My label>`
|
|
|
|
|
|
|
|
|
|
This link will work across the documentation. Make sure the label is globally unique.
|
|
|
|
|
|
|
|
|
|
Images
|
|
|
|
|
^^^^^^
|
|
|
|
|
|
2022-05-07 11:42:12 +10:00
|
|
|
The following colours and annotation styles should be used for annotating
|
2022-08-27 10:36:54 -04:00
|
|
|
images. All stroke widths are 3px with a corner radius of 3px. Horizontal
|
2023-07-18 18:28:46 +10:00
|
|
|
underlines are 5px with a corner radius of 2px. The dark green is ``39b54a`` and
|
|
|
|
|
the light green is ``d9e021``.
|
2022-05-07 11:42:12 +10:00
|
|
|
|
2023-11-07 09:58:13 +01:00
|
|
|
.. image:: images/documentation-style.png
|
2023-07-18 18:28:46 +10:00
|
|
|
|
|
|
|
|
Special keywords such as **Technical Terminology** that the user should be
|
|
|
|
|
aware of should be bolded, titlecased, and used consistently. You *may*
|
|
|
|
|
use italics to emphasize words or phrases. Inline code must be ``quoted`` and
|
|
|
|
|
longer code snippets may use code blocks.
|
|
|
|
|
|
2024-06-21 18:28:52 +05:00
|
|
|
.. code-block:: bash
|
2023-07-18 18:28:46 +10:00
|
|
|
|
2024-08-22 21:02:19 +10:00
|
|
|
cd /path/to/bonsai
|
2024-06-21 18:28:52 +05:00
|
|
|
ls
|
2023-07-18 18:28:46 +10:00
|
|
|
|
|
|
|
|
Be sure to specify the language to enable syntax highlighting.
|
|
|
|
|
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
print("Hello, world!")
|
|
|
|
|
|
|
|
|
|
A button may be used to point users to a critical sample file or
|
|
|
|
|
download.
|
|
|
|
|
|
|
|
|
|
.. container:: blockbutton
|
|
|
|
|
|
2024-08-14 15:20:25 +05:00
|
|
|
`Visit critical link <https://bonsaibim.org>`__
|
2023-07-18 18:28:46 +10:00
|
|
|
|
2023-09-07 18:11:55 +10:00
|
|
|
You can use bulleted lists:
|
|
|
|
|
|
|
|
|
|
- Like.
|
|
|
|
|
- This.
|
|
|
|
|
|
|
|
|
|
Or ordered lists:
|
|
|
|
|
|
|
|
|
|
1. Like.
|
|
|
|
|
2. This.
|
|
|
|
|
|
2023-07-18 18:28:46 +10:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
|
|
Instead of writing "Note that XYZ ..." you should use notes sparingly to
|
|
|
|
|
highlight "gotchas".
|
|
|
|
|
|
|
|
|
|
.. tip::
|
|
|
|
|
|
|
|
|
|
Tips may be used to add a useful but optional suggestion.
|
|
|
|
|
|
|
|
|
|
.. warning::
|
|
|
|
|
|
|
|
|
|
Warnings may be used to highlight common mistakes.
|
|
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
|
|
See also blocks should be used to reference `further reading
|
2024-08-14 15:20:25 +05:00
|
|
|
<https://bonsaibim.org>`__ links.
|
2023-08-30 18:15:10 +10:00
|
|
|
|
|
|
|
|
Tables can be very annoying to format. You can use a CSV table instead.
|
|
|
|
|
|
|
|
|
|
.. csv-table::
|
|
|
|
|
:header: "Foo", "Bar", "Baz"
|
|
|
|
|
|
|
|
|
|
"ABC", "01", "02"
|
|
|
|
|
"DEF", "03", "04"
|
2024-03-30 17:37:14 +11:00
|
|
|
|
|
|
|
|
Building documentation
|
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
|
|
If you want to build the documentation locally, the documentation system uses
|
|
|
|
|
`Sphinx <https://www.sphinx-doc.org/en/master/>`_. First, install the theme and
|
|
|
|
|
theme dependencies:
|
|
|
|
|
|
2024-06-21 18:28:52 +05:00
|
|
|
.. code-block:: bash
|
2024-03-30 17:37:14 +11:00
|
|
|
|
2024-06-21 18:28:52 +05:00
|
|
|
pip install furo
|
|
|
|
|
pip install sphinx-autoapi
|
|
|
|
|
pip install sphinx-copybutton
|
2024-03-30 17:37:14 +11:00
|
|
|
|
|
|
|
|
Now you can generate the documentation:
|
|
|
|
|
|
2024-06-21 18:28:52 +05:00
|
|
|
.. code-block:: bash
|
2024-03-30 17:37:14 +11:00
|
|
|
|
2024-08-22 21:02:19 +10:00
|
|
|
cd /path/to/ifcopenshell/src/bonsai/docs/
|
2024-06-21 18:28:52 +05:00
|
|
|
make html
|
|
|
|
|
cd _build/html
|
|
|
|
|
python -m http.server
|
2024-03-30 17:37:14 +11:00
|
|
|
|
|
|
|
|
You will now have a local webserver running hosting the documentation.
|