2 Copyright (c) 2016 Stephen Finucane <stephen@that.guru>
4 Licensed under the Apache License, Version 2.0 (the "License"); you may
5 not use this file except in compliance with the License. You may obtain
6 a copy of the License at
8 http://www.apache.org/licenses/LICENSE-2.0
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 License for the specific language governing permissions and limitations
16 Convention for heading levels in Open vSwitch documentation:
18 ======= Heading 0 (reserved for the title in a document)
24 Avoid deeper levels because they do not render well.
26 ================================
27 Open vSwitch Documentation Style
28 ================================
30 This file describes the documentation style used in all documentation found in
31 Open vSwitch. Documentation includes any documents found in ``Documentation``
32 along with any ``README``, ``INSTALL``, or generally ``rst`` suffixed documents
33 found in the project tree.
35 reStructuredText vs. Sphinx
36 ---------------------------
38 reStructuredText (reST) is the syntax, while Sphinx is a documentation
39 generator. Sphinx introduces a number of extensions to reST, like the
40 ``:ref:`` role, which can and should be used in documentation, but these will
41 not work correctly on GitHub. As such, these extensions should not be used in
42 any documentation in the root level, such as the ``README``.
50 Many of the basic documentation guidelines match those of the `coding style
51 guide <CodingStyle.rst>`__.
53 - Use reStructuredText (reST) for all documentation.
55 Sphinx extensions can be used, but only for documentation in the
56 ``Documentation`` folder.
58 - Limit lines at 79 characters.
61 An exception to this rule is text within code-block elements that cannot be
62 wrapped and links within references.
64 - Use spaces for indenation.
66 - Match indentation levels.
68 A change in indentation level usually signifies a change in content nesting,
69 by either closing the existing level or introducing a new level.
71 - Avoid trailing spaces on lines.
73 - Include a license (see this file) in all docs.
75 - Most importantly, always build and display documentation before submitting
76 changes! Docs aren't unit testable, so visible inspection is necessary.
81 - Use hyphens as space delimiters. For example: ``my-readme-document.rst``
83 - Use lowercase filenames.
86 An exception to this rule is any documents found in the root-level of the
92 - Use the following headers levels.
94 | ======= Heading 0 (reserved for the title in a document)
102 Avoid using lower heading levels by rewriting and reorganizing the
105 - Under- and overlines should be of the same length as that of the heading
108 - Use "title case" for headers.
113 - Use ``::``, the ``code`` role or the ``code-block:: <syntax>`` role to prefix
116 - Prefix commands with ``$``.
118 - Where possible, include fully-working snippets of code. If there
119 pre-requisites, explain what they are and how to achieve them.
124 - Use admonitions to call attention to important information.::
128 This is a sample callout for some useful tip or trick.
130 Example admonitions include: ``warning``, ``important``, ``note``, ``tip`` or
133 - Use notes sparingly. Avoid having more than one per subsection.
138 - Use either graphic tables, list tables or CSV tables.
145 .. table:: OVS-Linux kernel compatibility
147 ============ ==============
148 Open vSwitch Linux kernel
149 ============ ==============
153 ============ ==============
157 .. table:: OVS-Linux kernel compatibility
159 +--------------+---------------+
160 | Open vSwitch | Linux kernel |
161 +==============+===============+
162 | 1.4.x | 2.6.18 to 3.2 |
163 +--------------+---------------+
164 | 1.5.x | 2.6.18 to 3.2 |
165 +--------------+---------------+
166 | 1.6.x | 2.6.18 to 3.2 |
167 +--------------+---------------+
170 The ``table`` role - ``.. table:: <name>`` - can be safely omitted.
177 .. list-table:: OVS-Linux kernel compatibility
195 .. csv-table:: OVS-Linux kernel compatibility
196 :header: Open vSwitch, Linux kernel
206 - To link to an external file or document, include as a link.::
208 Here's a `link <http://openvswitch.org>`__ to the Open vSwitch website.
211 Here's a `link`_ in reference style.
213 .. _link: http://openvswitch.org
215 - You can also use citations.::
217 Refer to the Open vSwitch documentation [1]_.
222 .. [1]: http://openvswitch.org
224 - To cross-reference another doc, use the ``doc`` role.::
226 Here is a link to the :doc:`/README.rst`
229 This is a Sphinx extension. Do not use this in any top-level documents.
231 - To cross-reference an arbitrary location in a doc, use the ``ref`` role.::
243 Here is a cross-reference to :ref:`sample-crossref`.
246 This is a Sphinx extension. Do not use this in any top-level documents.
248 Figures and Other Media
249 ~~~~~~~~~~~~~~~~~~~~~~~
251 - All images should be in ASCII format and included in code-blocks to preserve
254 - Include other reStructuredText verbatim in a current document
259 - Comments are indicated by means of the ``..`` marker.::
261 .. TODO(stephenfin) This section needs some work. This TODO will not
262 appear in the final generated document, however.
267 Follow these guidelines to ensure readability and consistency of the Open
268 vSwitch documentation. These guidelines are based on the `IBM Style Guide
269 <http://www.redbooks.ibm.com/Redbooks.nsf/ibmpressisbn/9780132101301?Open>`__.
271 - Use standard US English
273 Use a spelling and grammar checking tool as necessary.
275 - Expand initialisms and acronyms on first usage.
277 Commonly used terms like CPU or RAM are allowed.
279 .. list-table:: Example
284 * - OVS is a virtual switch. OVS has...
285 - Open vSwitch (OVS) is a virtual switch. OVS has...
286 * - The VTEP emulator is...
287 - The Virtual Tunnel Endpoint (VTEP) emulator is...
289 - Write in the active voice
291 The subject should do the verb's action, rather than be acted upon.
293 .. list-table:: Example
298 * - A bridge is created by you
301 - Write in the present tense
303 .. list-table:: Example
308 * - Once the bridge is created, you can create a port
309 - Once the bridge is created, create a port
311 - Write in second person
313 .. list-table:: Example
318 * - To create a bridge, the user runs:
319 - To create a bridge, run:
321 - Keep sentences short and consise
323 - Eliminate needless politeness
325 Avoid "please" and "thank you"
330 * `Quick reStructuredText
331 <http://docutils.sourceforge.net/docs/user/rst/quickref.html>`__
332 * `Sphinx Documentation <http://sphinx.readthedocs.org/en/latest/rest.html>`__