|
| 1 | +:navigation-title: CGL for ReST files |
| 2 | + |
| 3 | +.. include:: /Includes.rst.txt |
| 4 | +.. _cgl: |
| 5 | + |
| 6 | +============================================= |
| 7 | +Coding guidelines for reStructured text files |
| 8 | +============================================= |
| 9 | + |
| 10 | +In the official documentation files we try to follow the following coding |
| 11 | +guidelines: |
| 12 | + |
| 13 | +* Indentation of 4 spaces, this includes |
| 14 | + `lists <https://docs.typo3.org/permalink/h2document:rest-lists>`_, directives, |
| 15 | + `Code blocks <https://docs.typo3.org/permalink/h2document:writing-rest-codeblocks-with-syntax-highlighting>`_, |
| 16 | + and other blocks that need to be indented in ReST. |
| 17 | +* Wrap lines at 80 chars where possible |
| 18 | +* We avoid abbreviations and colloquial language. When we use abbreviations |
| 19 | + they should be introduced in the same section. |
| 20 | +* Each ReST file must have a main header. |
| 21 | +* Each ReST file must include `.. include:: /Includes.rst.txt` to display |
| 22 | + global messages, for example for outdated versions. |
| 23 | +* It is highly recommended to use `:navigation-title: My Title` at the top |
| 24 | + of each file to provide a shorter title to be displayed in the menu. |
| 25 | + See `Navigation title: A page title displayed in menus <https://docs.typo3.org/permalink/h2document:navigation-title>`_. |
| 26 | + |
| 27 | +.. literalinclude:: _general.rst.txt |
| 28 | + :caption: Documentation/Introduction.rst |
| 29 | + |
| 30 | +.. _cgl-code: |
| 31 | + |
| 32 | +Rules for code examples |
| 33 | +======================= |
| 34 | + |
| 35 | +* Wrap code examples at 80 chars where possible to avoid horizontal scrolling. |
| 36 | +* Code examples longer then a few lines should go in external files to be |
| 37 | + included. |
| 38 | +* All code examples should lint. They should demonstrate best practices. |
| 39 | + Where best practices would over complicate things, mention that this is not |
| 40 | + a best practice but used for demonstration. |
| 41 | + |
| 42 | +.. literalinclude:: _code.rst.txt |
| 43 | + :caption: Documentation/Installation.rst |
| 44 | + |
| 45 | +.. _cgl-headlines: |
| 46 | + |
| 47 | +Rules headlines |
| 48 | +=============== |
| 49 | + |
| 50 | +* Headlines are in sentence case. |
| 51 | +* Each headline should be possible to understand without context. This improves |
| 52 | + search results in the internal search and search engines. |
| 53 | +* Use the official order for marking headlines. The page title is overlined |
| 54 | + and underlined with `=`, headlines of level 2 are underlined with `=`, |
| 55 | + level 3 with `-` and level 4 with `~`. |
| 56 | +* Each headline should have a unique anchor so that permalinks to the headline |
| 57 | + can be generated. |
| 58 | + |
| 59 | +.. literalinclude:: _headlines.rst.txt |
| 60 | + :caption: Documentation/HeaderDemo.rst |
| 61 | + |
| 62 | +See `Headlines and Anchors <https://docs.typo3.org/permalink/h2document:headlines-and-sections>`_ |
| 63 | +for more headline levels. |
0 commit comments