reST cheatsheet
Math
.. math::
:name: Fourier transform
(\mathcal{F}f)(y)
= \frac{1}{\sqrt{2\pi}^{\ n}}
\int_{\mathbb{R}^n} f(x)\,
e^{-\mathrm{i} y \cdot x} \,\mathrm{d} x.
The ``:name:`` option puts a label on the equation that can be linked to
by hyperlink references. In this case, you could link back to the previous
math equation using the `Fourier transform`_ hyperlink reference.
The :name: option puts a label on the equation that can be linked to
by hyperlink references. In this case, you could link back to the previous
math equation using the Fourier transform hyperlink reference.
Headings
Use # to underline 1st level headers.
Use * to underline 2nd level headers.
Use = to underline 3rd level headers.
Use - to underline 4th level headers.
Use ^ to underline 5th level headers.
Use “ to underline 6th level headers.
Tables
+------------------------+------------+----------+----------+
| Header row, column 1 | Header 2 | Header 3 | Header 4 |
| (header rows optional) | | | |
+========================+============+==========+==========+
| body row 1, column 1 | column 2 | column 3 | column 4 |
+------------------------+------------+----------+----------+
| body row 2 | ... | ... | |
+------------------------+------------+----------+----------+
===== ===== =======
A B A and B
===== ===== =======
False False False
True False False
False True False
True True True
===== ===== =======
Header row, column 1 (header rows optional) |
Header 2 |
Header 3 |
Header 4 |
|---|---|---|---|
body row 1, column 1 |
column 2 |
column 3 |
column 4 |
body row 2 |
… |
… |
A |
B |
A and B |
|---|---|---|
False |
False |
False |
True |
False |
False |
False |
True |
False |
True |
True |
True |
Links
This is a paragraph that contains `a link`_.
.. _a link: https://domain.invalid/
This is a paragraph that contains a link.
Code
This is a normal text paragraph. The next paragraph is a code sample::
It is not processed in any way, except
that the indentation is removed.
It can span multiple lines.
This is a normal text paragraph again.
This is a normal text paragraph. The next paragraph is a code sample:
It is not processed in any way, except
that the indentation is removed.
It can span multiple lines.
This is a normal text paragraph again.
>>> 1 + 1
2
Terms
term (up to a line of text)
Definition of the term, which must be indented
and can even consist of multiple paragraphs
next term
Description.
- term (up to a line of text)
Definition of the term, which must be indented
and can even consist of multiple paragraphs
- next term
Description.
Lists
* This is a bulleted list.
* It has two items, the second
item uses two lines.
1. This is a numbered list.
2. It has two items too.
#. This is a numbered list.
#. It has two items too.
This is a bulleted list.
It has two items, the second item uses two lines.
This is a numbered list.
It has two items too.
This is a numbered list.
It has two items too.
Nested lists
1. fruits
* apple
* banana
2. vegetables
* carrot
* broccoli
fruits
apple
banana
vegetables
carrot
broccoli
Inline markup
The standard reStructuredText inline markup is quite simple: use
one asterisk: *text* for emphasis (italics),
two asterisks: **text** for strong emphasis (boldface), and
backquotes: ``text`` for code samples.
If text is indented, it is treated as a block quotation:
Should array indices start at 0 or 1?
My suggested compromise of 0.5 was rejected without, I thought, proper consideration
-- Stan Kelly-Bootle
The standard reStructuredText inline markup is quite simple: use
one asterisk: text for emphasis (italics),
two asterisks: text for strong emphasis (boldface), and
backquotes: text for code samples.
If text is indented, it is treated as a block quotation:
Should array indices start at 0 or 1? My suggested compromise of 0.5 was rejected without, I thought, proper consideration – Stan Kelly-Bootle
Code-block
.. code-block:: bash
#!/bin/bash
#
# Weekly maintenance print voor Canon Pro 300
# Met foutdetectie, queue-checks en logging voor cron
#
set -euo pipefail
# Log alles naar stdout/stderr zodat cron het mailt
echo "=== Weekly print gestart: $(date) ==="
#!/bin/bash
#
# Weekly maintenance print voor Canon Pro 300
# Met foutdetectie, queue-checks en logging voor cron
#
set -euo pipefail
# Log alles naar stdout/stderr zodat cron het mailt
echo "=== Weekly print gestart: $(date) ==="
Role
.. role:: python(code)
:language: python
In Python, :python:`1 + 2` is equal to :python:`3`.
In Python, 1 + 2 is equal to 3.
Admonition
.. attention::
Information that requires the reader’s attention. The content of the directive should be written in complete sentences and include all appropriate punctuation.
.. caution::
Information with regard to which the reader should exercise care. The content of the directive should be written in complete sentences and include all appropriate punctuation.
.. danger::
Information which may lead to near and present danger if not heeded. The content of the directive should be written in complete sentences and include all appropriate punctuation.
.. error::
Information relating to failure modes of some description. The content of the directive should be written in complete sentences and include all appropriate punctuation.
.. hint::
Information that is helpful to the reader. The content of the directive should be written in complete sentences and include all appropriate punctuation.
.. important::
Information that is of paramount importance and which the reader must not ignore. The content of the directive should be written in complete sentences and include all appropriate punctuation.
.. note::
An especially important bit of information that the reader should know. The content of the directive should be written in complete sentences and include all appropriate punctuation.
.. tip::
Some useful tidbit of information for the reader. The content of the directive should be written in complete sentences and include all appropriate punctuation.
.. warning::
An important bit of information that the reader should be very aware of. The content of the directive should be written in complete sentences and include all appropriate punctuation.
.. admonition:: Belangrijk
Dit is een aangepaste admonition.
Je kunt hier elke tekst, lijst of codeblok in plaatsen.
.. seealso::
Many sections include a list of references to module documentation or external documents. These lists are created using the seealso directive.
Attention
Information that requires the reader’s attention. The content of the directive should be written in complete sentences and include all appropriate punctuation.
Caution
Information with regard to which the reader should exercise care. The content of the directive should be written in complete sentences and include all appropriate punctuation.
Danger
Information which may lead to near and present danger if not heeded. The content of the directive should be written in complete sentences and include all appropriate punctuation.
Error
Information relating to failure modes of some description. The content of the directive should be written in complete sentences and include all appropriate punctuation.
Hint
Information that is helpful to the reader. The content of the directive should be written in complete sentences and include all appropriate punctuation.
Important
Information that is of paramount importance and which the reader must not ignore. The content of the directive should be written in complete sentences and include all appropriate punctuation.
Note
An especially important bit of information that the reader should know. The content of the directive should be written in complete sentences and include all appropriate punctuation.
Tip
Some useful tidbit of information for the reader. The content of the directive should be written in complete sentences and include all appropriate punctuation.
Warning
An important bit of information that the reader should be very aware of. The content of the directive should be written in complete sentences and include all appropriate punctuation.
Belangrijk!
Dit is een aangepaste admonition. Je kunt hier elke tekst, lijst of codeblok in plaatsen.
See also
Many sections include a list of references to module documentation or external documents. These lists are created using the seealso directive.
Footnotes
Lorem ipsum [#f1]_ dolor sit amet ... [#f2]_
Lorem ipsum [1] dolor sit amet … [2]
.. rubric:: Footnotes
.. [#f1] Text of the first footnote.
.. [#f2] Text of the second footnote.
Footnotes