rst Cheatsheet¶
The rst Cheatsheet covers a wide range of rst markup. It and its contents are CC licensed.
Inline Markup¶
Inline markup allows words and phrases within text to have character styles (like italics and boldface) and functionality (like hyperlinks).
|
emphasis |
|
strong emphasis |
|
The rendering and meaning of interpreted text is domain- or application-dependent. |
|
|
|
|
|
|
|
|
|
inline internal target |
|
The result is substituted in from the substitution definition. |
|
footnote reference [1] |
|
citation reference [CIT2002] |
|
Escaping with Backslashes¶
reStructuredText uses backslashes (”\”) to override the special meaning given to markup characters and get the literal characters themselves. To get a literal backslash, use an escaped backslash (”\\”). For example:
|
escape |
|
*escape* ``with`` “\” |
Lists¶
|
|
|
|
|
|
|
|
|
|
Section Structure¶
|
Title Titles are underlined (or over- and underlined) with a nonalphanumeric character at least as long as the text. A lone top-level section is lifted up to be the document’s title. Any non-alphanumeric character can be used, but Python convention is:
|
Blocks¶
|
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 that the following indented or quoted text is a literal block.
You can also tack the
Per-line quoting can also be used for unindented blocks:
|
|
|
Line blocks are useful for addresses,
verse, and adornment-free lists.
Each new line begins with a
vertical bar (“|”).
Line breaks and initial indents
are preserved.
Continuation lines are wrapped
portions of long lines; they begin
with spaces in place of vertical bars.
|
|
|
Block quotes are just:
|
|
|
Doctest blocks are interactive
Python sessions. They begin with
“
|
|
|
A transition marker is a horizontal line of 4 or more repeated punctuation characters. A transition should not begin or end a section or document, nor should two transitions be immediately adjacent. |
Tables¶
There are two syntaxes for tables in reStructuredText. Grid tables are complete but cumbersome to create. Simple tables are easy to create but limited (no row spans, etc.).
|
|
||||||||||||||||||
|
|
Explicit Markup¶
Explicit markup blocks are used for constructs which float (footnotes), have no direct paper-document representation (hyperlink targets, comments), or require specialized processing (directives). They all begin with two periods and whitespace, the “explicit markup start”.
|
Footnote references, like [5]. Note that footnotes may get rearranged, e.g., to the bottom of the “page”. |
|
Autonumbered footnotes are possible, like using [1] and [2]. This is the first one. This is the second one. They may be assigned ‘autonumber labels’ - for instance, [4] and [3]. a.k.a. third a.k.a. fourth |
|
Auto-symbol footnotes are also possible, like this: [*] and [†]. This is the first one. This is the second one. |
|
Citation references, like [CIT2002]. Note that citations may get rearranged, e.g., to the bottom of the “page”. Citation labels contain alphanumerics, underlines, hyphens and fullstops. Case is not significant. Given a citation like [this], one can also refer to it like this.
[this]
here. |
|
External hyperlinks, like Python. |
|
External hyperlinks, like Python. |
|
Internal crossreferences, like example. This is an example crossreference target. |
|
|
|
Titles are targets, too Implict references, like Titles are targets, too. |
Directives are a general-purpose extension mechanism, a way of adding support for new constructs without adding new syntax. For a description of all standard directives, see reStructuredText Directives (http://is.gd/2Ecqh). |
|
|
For instance: |
Substitutions are like inline directives, allowing graphics and arbitrary constructs within text. |
|
|
The symbol must be used on containers used to dispose of medical waste. |
Any text which begins with an explicit markup start but doesn’t use the syntax of any of the constructs above, is a comment. |
|
|
|
|
An “empty comment” does not consume following blocks. (An empty comment is “..” with blank lines before and after.)
|
Credits¶
CP Font from LiquiType: |
|
Magnetic Balls V2 image by fdecomite: |
|
Sponsored by Net Managers |
|
Typeset using rst2pdf |
© 2009 Roberto Alsina <ralsina@netmanagers.com.ar> / Creative Commons Attribution-Noncommercial-Share Alike 2.5 Argentina License |