Rst Cheat Sheet



RST Cheatsheet, Release 1.0.1 CHAPTER 5 Blocks This is a paragraph. Paragraphs line up at their left edges, ˓→and are normally separated by blank lines. This is a paragraph. Paragraphs line up at their left edges, and are normally separated by blank lines. A paragraph containing only two colons ˓→indicates the following indented or quoted.

  • Instead of using the contents directive to show a table of its own contents, the index file uses the toctree directive to show a table of other files. All files in the archive should be reachable from the toctrees in the index. Files can also contain toctrees of their own, which can lead to other files not referenced directly by the index.
  • This cheat sheet explains how to use common reStructuredText formatting with the Sphinx documentation generator. Figure:: /img/rst-cheatsheet-earth.jpg Caption goes here. Text after the image goes here. To insert a figure with no caption, replace the caption with an empty comment.

Every reST (.rst) file should use these underlining styles. In reST, you can use differentstyles in any order you want. These are our conventions for TYPO3 documentation.

  • line 1-3: This is the doc title. Every .rst file should have one.

  • line 7: header label. This can be used for cross-referencing to this section:

  • 9-10: Header level 1

  • etc.

See also

External links¶

method 1:

(with one or two underscores at the end, if in doubt, use two)

method 2: “External Hyperlink Targets”:

This may be more convenient if you use a link several times.

Cross references¶

When linking within docs.typo3.org, you should use this method of cross-referencing.

Use it to link to a section in this manual:

A section with the label intersphinx must exist! It is placed before the header:

Or, when cross-referencing to other manuals:

When you are linking to another manual, make sure theshortcut (here: “h2document”) is included in Settings.cfg:

We use the same conventions for naming the shortcuts in Settings.cfg,see Settings.cfg. Not used manuals are commented out.

Tip

This is a cool feature, where reST & Sphinx shines: Even when a section ismoved to another page (which effectively changes the URL), the link will still work!

Link to: Same manualLink to: Other manual
Explicit anchor text:ref:`CrossReferencing<intersphinx>`:ref:`CrossReferencing<t3docwrite:intersphinx>`
Automatic anchor text:ref:`intersphinx`:ref:`t3docwrite:intersphinx`

See also

  • Link targets (labels)

To create a bullet list:

  • add a blank line before and after the list
  • indent the list item text by 3 spaces - including the item sign
  • to create a nested list:
    • indent the items by 3 spaces (left-align with parent item text)
    • apply rules of parent list (blank lines, item text indentation, ..)

More text.

To create a numbered list:

  1. add a blank line before and after the list
  2. indent the list item text by 3 spaces - including the item sign
  3. to create a nested list:
    1. indent the items by 3 spaces (left-align with parent item text)
    2. apply rules of parent list (blank lines, item text indentation, ..)

More text.

Important

Use syntactically correct code in your code blocks.

Code block directive¶

How it looks:

Source:

This uses the directive “code-block” (line 1)

Important

Make sure to indent correctly. The lines of the code-block (line 3+)must be indented (3 spaces).

Rst Cheat Sheets

Literal Block (::

Or, use the literal block markup :: if PHP is already set as defaultwith highlight directive and you want to combine a text with a colon,followed by the code block.

Rst

How it looks:

Assign the variable a:

Source:

Rst Cheat Sheet Pdf

For inline code or for other semantic markup of special texts, use text roles.

Examples:

  1. $result=$a+23; (PHP snippet)
  2. lib.hello.value=HelloWorld! (TypoScript snippets)
  3. /etc/passwd (file)
  4. ctrl + s (keyboard strokes)

Source (inline text with text roles):

Normal text, bold text and italic text.

Source (bold & italic):

Source (image):

Another example:

Rst Cheat Sheet

See also

Source (YouTube):

This is often used, for a Quick Start section, involving a few numbered steps:

Rst Cheat Sheet Excel

With Big Numbers¶

This is an example with a code block (::) embedded in the sections.

Source:

How it looks:

  1. Embed an image

    Source:

  2. Two

    Do something else …

With Big Numbers XXL¶

Source:

How it looks:

  1. Embed an image

    Source:

  2. Two

    Do something else …

Tips, hints, important (Admonitions)¶

Tip

To look at the reST source of this rendered page, scroll to the bottomand click on “View page source”.

Source (tip):

Diagrams

Rst Cheat Sheet

Source:

Rst Cheat Sheet Printable

How it looks: