1 # coreboot documentation guidelines
3 > Documentation is like sex: when it is good, it is very, very good;
4 > and when it is bad, it is better than nothing.
6 That said please always try to write documentation! One problem in the
7 firmware development is the missing documentation. In this document
8 you will get a brief introduction how to write, submit and publish
9 documentation to coreboot.
13 coreboot uses [Sphinx] documentation tool. We prefer the markdown format
14 over reStructuredText so only embedded ReST is supported. Checkout the
15 [Markdown Guide] for more information.
17 ### option 1: Use the docker image
19 The easiest way to build the documentation is using a docker image.
20 To build the image run the following in the base directory:
22 make -C util/docker/ doc.coreboot.org
24 Before building the documentation make sure the output directory is given
25 the correct permissions before running docker.
27 mkdir -p Documentation/_build
29 To build the documentation:
31 make -C util/docker docker-build-docs
33 To have the documentation build and served over a web server live run:
35 make -C util/docker docker-livehtml-docs
37 On the host machine, open a browser to the address <http://0.0.0.0:8000>.
39 ### option 2: Install Sphinx
41 Please follow this official [guide] to install sphinx.
42 You will also need python-recommonmark for sphinx to be able to handle
43 markdown documentation.
45 Since some Linux distributions don't package every needed sphinx extension,
46 the installation via pip in a venv is recommended. You'll need these python3
53 The following combination of versions has been tested: sphinx 2.3.1,
54 recommonmark 0.6.0, and sphinx_rtd_theme 0.4.3.
56 Now change into the `Documentation` folder in the coreboot directory and run
61 If no error occurs, you can find the generated HTML documentation in
62 `Documentation/_build` now.
66 Install [sphinx-autobuild] for rebuilding markdown/rst sources on the fly!
68 ## Basic and simple rules
70 The following rules should be followed in order to get it at least reviewed
71 on [review.coreboot.org].
75 1. Must be written in **markdown** with **embedded reStructuredText**
77 2. Must be written in **English**.
78 3. Must be placed into **Documentation/** directory subfolder.
79 4. Should follow the same directory structure as **src/** when practical.
80 5. Must be referenced from within other markdown files
81 6. The commit must follow the [Gerrit Guidelines].
82 7. Must have all **lowercase filenames**.
83 8. Running text should have a visible width of about **72 chars**.
84 9. Should not **duplicate** documentation, but reference it instead.
85 10. Must not include the same picture in multiple markdown files.
86 11. Images should be kept small. They should be under 700px in width, as
87 the current theme doesn't allow bigger images.
88 12. Shouldn't cover implementation details; for details, the code is the
91 ## Referencing markdown documents
93 Starting with Sphinx 1.6 recommonmark's *auto_doc_ref* feature is broken.
94 To reference documents use the TOC tree or inline RST code.
96 ## Markdown and Tables
98 Under Sphinx markdown tables are not supported. Therefore you can use following
99 code block to write tables in reStructuredText and embed them into the markdown:
102 +------------+------------+-----------+
103 | Header 1 | Header 2 | Header 3 |
104 +============+============+===========+
105 | body row 1 | column 2 | column 3 |
106 +------------+------------+-----------+
107 | body row 2 | Cells may span columns.|
108 +------------+------------+-----------+
109 | body row 3 | Cells may | - Cells |
110 +------------+ span rows. | - contain |
111 | body row 4 | | - blocks. |
112 +------------+------------+-----------+
113 ``` #just a code block is enough
117 To make sure that all documents are included into the final documentation, you
118 must reference each document from at least one *toctree*. The *toctree* must
119 only reference files in the same folder or in subfolders !
120 To create a toctree, simply use a bullet list or numbered list with a single
121 reference. References in regular text aren't considered as *toctree* .
122 This feature is enabled by recommonmark's *enable_auto_toc_tree* .
127 * [Chapter 1](chapter1.md)
128 * [Chapter 2](chapter2.md)
129 * [Subchapter](sub/index.md)
133 1. [Chapter 1](chapter1.md)
134 2. [Chapter 2](chapter2.md)
137 If you do only reference the document, but do not include it in any toctree,
138 you'll see the following warning:
139 **WARNING: document isn't included in any toctree**
143 You can import CSV files and let sphinx automatically convert them to human
144 readable tables, using the following reStructuredText snipped:
148 :header: "Key", "Value"
152 Of course this can only be done from a markdown file that is included in the
155 [coreboot]: https://coreboot.org
156 [Documentation]: https://review.coreboot.org/cgit/coreboot.git/tree/Documentation
157 [sphinx-autobuild]: https://github.com/GaretJax/sphinx-autobuild
158 [guide]: http://www.sphinx-doc.org/en/stable/install.html
159 [Sphinx]: http://www.sphinx-doc.org/en/master/
160 [Markdown Guide]: https://www.markdownguide.org/
161 [Gerrit Guidelines]: ../contributing/gerrit_guidelines.md
162 [review.coreboot.org]: https://review.coreboot.org