Debian Codegraph @

docs/user/rst/cheatsheet.rst

raw
1 =====================================================
2 The reStructuredText_ Cheat Sheet: Syntax Reminders
3 =====================================================
4 :Info: See <https://docutils.sourceforge.io/rst.html> for introductory docs.
5 :Author: David Goodger <[email protected]>
6 :Date: $Date: 2025-09-13 18:01:09 +0200 (Sa, 13. Sep 2025) $
7 :Revision: $Revision: 10232 $
8 :Description: This is a "docinfo block", or bibliographic field list
9
10 .. NOTE:: If you are reading this as HTML, please read
11 `<cheatsheet.rst>`_ instead to see the input syntax examples!
12
13 Section Structure
14 =================
15 Section titles are underlined or overlined & underlined.
16
17 Body Elements
18 =============
19 Grid table:
20
21 +--------------------------------+-----------------------------------+
22 | Paragraphs are flush-left, | Literal block, preceded by "::":: |
23 | separated by blank lines. | |
24 | | Indented |
25 | Block quotes are indented. | |
26 +--------------------------------+ or:: |
27 | >>> print 'Doctest block' | |
28 | Doctest block | > Quoted |
29 +--------------------------------+-----------------------------------+
30 | | Line blocks preserve line breaks & indents. |
31 | | Useful for addresses, verse, and adornment-free lists; long |
32 | lines can be wrapped with continuation lines. |
33 +--------------------------------------------------------------------+
34
35 Simple tables:
36
37 ================ ============================================================
38 List Type Examples (syntax in the `text source <cheatsheet.rst>`_)
39 ================ ============================================================
40 Bullet list * items begin with "-", "+", or "*"
41 Enumerated list 1. items use any variation of "1.", "A)", and "(i)"
42 #. also auto-enumerated
43 Definition list Term is flush-left : optional classifier
44 Definition is indented, no blank line between
45 Field list :field name: field body
46 Option list -o at least 2 spaces between option & description
47 ================ ============================================================
48
49 ================ ============================================================
50 Explicit Markup Examples (visible in the `text source`_)
51 ================ ============================================================
52 Footnote .. [1] Manually numbered or [#] auto-numbered
53 (even [#labelled]) or [*] auto-symbol
54 Citation .. [CIT2002] A citation.
55 Hyperlink Target .. _reStructuredText: https://docutils.sourceforge.io/rst.html
56 .. _indirect target: reStructuredText_
57 .. _internal target:
58 Anonymous Target __ https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html
59 Directive ("::") .. image:: images/biohazard.png
60 Substitution Def .. |substitution| replace:: like an inline directive
61 Comment .. is anything else
62 Empty Comment (".." on a line by itself, with blank lines before & after,
63 used to separate indentation contexts)
64 ================ ============================================================
65
66 Inline Markup
67 =============
68 *emphasis*; **strong emphasis**; `interpreted text`; `interpreted text
69 with role`:emphasis:; ``inline literal text``; standalone hyperlink,
70 https://docutils.sourceforge.io; named reference, reStructuredText_;
71 `anonymous reference`__; footnote reference, [1]_; citation reference,
72 [CIT2002]_; |substitution|; _`inline internal target`.
73
74 Directive Quick Reference
75 =========================
76 See <https://docutils.sourceforge.io/docs/ref/rst/directives.html> for full info.
77
78 ================ ============================================================
79 Directive Name Description
80 ================ ============================================================
81 attention Specific admonition; also "caution", "danger",
82 "error", "hint", "important", "note", "tip", "warning"
83 admonition Generic titled admonition: ``.. admonition:: By The Way``
84 image ``.. image:: picture.png``; many options possible
85 figure Like "image", but with optional caption and legend
86 topic ``.. topic:: Title``; like a mini section
87 sidebar ``.. sidebar:: Title``; like a mini parallel document
88 parsed-literal A literal block with parsed inline markup
89 code Literal block for code with optional syntax highlighting
90 math Mathematical notation (input in LaTeX format)
91 rubric ``.. rubric:: Informal Heading``
92 epigraph Block quote with class="epigraph"
93 highlights Block quote with class="highlights"
94 pull-quote Block quote with class="pull-quote"
95 compound Compound paragraphs
96 container Generic block-level container element
97 table Create a titled table
98 list-table Create a table from a uniform two-level bullet list
99 csv-table Create a table from CSV data
100 contents Generate a table of contents
101 sectnum Automatically number sections, subsections, etc.
102 header, footer Create document decorations
103 target-notes Create an explicit footnote for each external target
104 replace Replacement text for substitution definitions
105 unicode Unicode character code conversion for substitution defs
106 date Generates today's date; for substitution defs
107 include Read an external reST file as if it were inline
108 raw Non-reST data passed untouched to the Writer
109 class Set a "class" attribute on the next element
110 role Create a custom interpreted text role
111 default-role Set the default interpreted text role
112 meta Document metadata
113 title Set the metadata document title
114 ================ ============================================================
115
116 Interpreted Text Role Quick Reference
117 =====================================
118 See <https://docutils.sourceforge.io/docs/ref/rst/roles.html> for full info.
119
120 ================ ============================================================
121 Role Name Description
122 ================ ============================================================
123 code code in a formal language (see docs for syntax highlighting)
124 emphasis Equivalent to *emphasis*
125 literal Equivalent to ``literal`` but processes backslash escapes
126 math Mathematical notation (input in LaTeX format)
127 PEP Reference to a numbered Python Enhancement Proposal
128 RFC Reference to a numbered Internet Request For Comments
129 raw For non-reST data; cannot be used directly (see docs)
130 strong Equivalent to **strong**
131 sub Subscript
132 sup Superscript
133 title Title reference (book, etc.); standard default role
134 ================ ============================================================