2018-05-28 09:36:42 +02:00
|
|
|
# coreboot documentation guidelines
|
|
|
|
|
|
|
|
> Documentation is like sex: when it is good, it is very, very good;
|
|
|
|
> and when it is bad, it is better than nothing.
|
|
|
|
|
|
|
|
That said please always try to write documentation! One problem in the
|
|
|
|
firmware development is the missing documentation. In this document
|
|
|
|
you will get a brief introduction how to write, submit and publish
|
|
|
|
documenation to coreboot.
|
|
|
|
|
|
|
|
## Preparations
|
|
|
|
|
|
|
|
coreboot uses [Sphinx] documentation tool. We prefer the markdown format
|
|
|
|
over reStructuredText so only embedded ReST is supported. Checkout the
|
|
|
|
[Markdown Guide] for more information.
|
|
|
|
|
|
|
|
### Install Sphinx
|
|
|
|
|
2018-07-25 12:05:15 +02:00
|
|
|
Please follow this official [guide] to install sphinx.
|
|
|
|
You will also need python-recommonmark for sphinx to be able to handle
|
2019-10-17 22:10:28 +02:00
|
|
|
markdown documentation.
|
2018-05-28 09:36:42 +02:00
|
|
|
|
2018-07-28 23:38:54 +02:00
|
|
|
The recommended version is sphinx 1.7.7, sphinx_rtd_theme 0.4.1 and
|
|
|
|
recommonmark 0.4.0.
|
|
|
|
|
2018-05-28 09:36:42 +02:00
|
|
|
### Optional
|
|
|
|
|
2019-10-21 11:15:43 +02:00
|
|
|
Install [sphinx-autobuild] for rebuilding markdown/rst sources on the fly!
|
2018-05-28 09:36:42 +02:00
|
|
|
|
|
|
|
## Basic and simple rules
|
|
|
|
|
|
|
|
The following rules should be followed in order to get it at least reviewed
|
|
|
|
on [review.coreboot.org].
|
|
|
|
|
|
|
|
Documentation:
|
|
|
|
|
|
|
|
1. Must be written in **markdown** with **embedded reStructuredText**
|
|
|
|
format.
|
|
|
|
2. Must be written in **English**.
|
|
|
|
3. Must be placed into **Documentation/** directory subfolder.
|
|
|
|
4. Should follow the same directory structure as **src/** when practical.
|
|
|
|
5. Must be referenced from within other markdown files
|
|
|
|
6. The commit must follow the [Gerrit Guidelines].
|
|
|
|
7. Must have all **lowercase filenames**.
|
|
|
|
8. Running text should have a visible width of about **72 chars**.
|
|
|
|
9. Should not **duplicate** documentation, but reference it instead.
|
|
|
|
10. Must not include the same picture in multiple markdown files.
|
|
|
|
11. Images should be kept small. They should be under 700px in width, as
|
|
|
|
the current theme doesn't allow bigger images.
|
|
|
|
12. Shouldn't cover implementation details; for details, the code is the
|
|
|
|
reference.
|
|
|
|
|
2018-07-28 23:38:54 +02:00
|
|
|
## Referencing markdown documents
|
|
|
|
|
|
|
|
Starting with Sphinx 1.6 recommonmark's *auto_doc_ref* feature is broken.
|
|
|
|
To reference documents use the TOC tree or inline RST code.
|
|
|
|
|
2018-05-28 09:36:42 +02:00
|
|
|
## Markdown and Tables
|
|
|
|
|
|
|
|
Under Sphinx markdown tables are not supported. Therefore you can use following
|
|
|
|
code block to write tables in reStructuredText and embed them into the markdown:
|
|
|
|
|
|
|
|
```eval_rst
|
|
|
|
+------------+------------+-----------+
|
|
|
|
| Header 1 | Header 2 | Header 3 |
|
|
|
|
+============+============+===========+
|
|
|
|
| body row 1 | column 2 | column 3 |
|
|
|
|
+------------+------------+-----------+
|
|
|
|
| body row 2 | Cells may span columns.|
|
|
|
|
+------------+------------+-----------+
|
|
|
|
| body row 3 | Cells may | - Cells |
|
|
|
|
+------------+ span rows. | - contain |
|
|
|
|
| body row 4 | | - blocks. |
|
|
|
|
+------------+------------+-----------+
|
|
|
|
``` #just a code block is enough
|
|
|
|
|
2018-09-01 17:22:20 +02:00
|
|
|
## TocTree
|
|
|
|
|
|
|
|
To make sure that all documents are included into the final documentation, you
|
|
|
|
must reference each document from at least one *toctree*. The *toctree* must
|
|
|
|
only reference files in the same folder or in subfolders !
|
|
|
|
To create a toctree, simply use a bullet list or numbered list with a single
|
|
|
|
reference. References in regular text aren't considered as *toctree* .
|
|
|
|
This feature is enabled by recommonmark's *enable_auto_toc_tree* .
|
|
|
|
|
|
|
|
**Example toctree:**
|
|
|
|
|
|
|
|
```
|
|
|
|
* [Chapter 1](chapter1.md)
|
|
|
|
* [Chapter 2](chapter2.md)
|
|
|
|
* [Subchapter](sub/index.md)
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
1. [Chapter 1](chapter1.md)
|
|
|
|
2. [Chapter 2](chapter2.md)
|
|
|
|
```
|
|
|
|
|
|
|
|
If you do only reference the document, but do not include it in any toctree,
|
|
|
|
you'll see the following warning:
|
|
|
|
**WARNING: document isn't included in any toctree**
|
|
|
|
|
2019-04-09 14:12:55 +02:00
|
|
|
## CSV
|
|
|
|
|
|
|
|
You can import CSV files and let sphinx automatically convert them to human
|
|
|
|
readable tables, using the following reStructuredText snipped:
|
|
|
|
|
|
|
|
```eval_rst
|
|
|
|
.. csv-table::
|
|
|
|
:header: "Key", "Value"
|
|
|
|
:file: keyvalues.csv
|
|
|
|
```
|
|
|
|
|
|
|
|
Of course this can only be done from a markdown file that is included in the
|
|
|
|
TOC tree.
|
|
|
|
|
2018-05-28 09:36:42 +02:00
|
|
|
[coreboot]: https://coreboot.org
|
|
|
|
[Documentation]: https://review.coreboot.org/cgit/coreboot.git/tree/Documentation
|
2019-10-21 11:15:43 +02:00
|
|
|
[sphinx-autobuild]: https://github.com/GaretJax/sphinx-autobuild
|
2018-05-28 09:36:42 +02:00
|
|
|
[guide]: http://www.sphinx-doc.org/en/stable/install.html
|
|
|
|
[Sphinx]: http://www.sphinx-doc.org/en/master/
|
|
|
|
[Markdown Guide]: https://www.markdownguide.org/
|
2019-04-02 20:26:25 +02:00
|
|
|
[Gerrit Guidelines]: gerrit_guidelines.md
|
2018-05-28 09:36:42 +02:00
|
|
|
[review.coreboot.org]: https://review.coreboot.org
|