1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
4
<title>Quick reStructuredText</title>
6
<style type="text/css"><!--
7
a.backref { text-decoration: none ; color: black }
13
<h1>Quick <i>re</i><font size="+4"><tt>Structured</tt></font><i>Text</i></h1>
15
<!-- Caveat: if you're reading the HTML for the examples, -->
16
<!-- beware that it was hand-generated, not by Docutils/ReST. -->
18
<p align="right"><em><a href="http://docutils.sourceforge.net/docs/rst/quickref.html"
19
>http://docutils.sourceforge.net/docs/rst/quickref.html</a></em>
20
<br align="right"><em>Being a cheat-sheet for reStructuredText</em>
21
<br align="right"><em>Updated 2004-02-23</em>
24
<p>Copyright: This document has been placed in the public domain.
28
<p>The full details of the markup may be found on the
29
<a href="http://docutils.sourceforge.net/rst.html">reStructuredText</a>
30
page. This document is just intended as a reminder.
32
<p>Links that look like "(<a href="#details">details</a>)" point
33
into the HTML version of the full <a
34
href="../../spec/rst/reStructuredText.html">reStructuredText
35
specification</a> document. These are relative links; if they
36
don't work, please use the <a
37
href="http://docutils.sourceforge.net/docs/rst/quickref.html"
38
>master "Quick reStructuredText"</a> document.
40
<h2><a name="contents">Contents</a></h2>
43
<li><a href="#inline-markup">Inline Markup</a></li>
44
<li><a href="#escaping">Escaping with Backslashes</a></li>
45
<li><a href="#section-structure">Section Structure</a></li>
46
<li><a href="#paragraphs">Paragraphs</a></li>
47
<li><a href="#bullet-lists">Bullet Lists</a></li>
48
<li><a href="#enumerated-lists">Enumerated Lists</a></li>
49
<li><a href="#definition-lists">Definition Lists</a></li>
50
<li><a href="#field-lists">Field Lists</a></li>
51
<li><a href="#option-lists">Option Lists</a></li>
52
<li><a href="#literal-blocks">Literal Blocks</a></li>
53
<li><a href="#block-quotes">Block Quotes</a></li>
54
<li><a href="#doctest-blocks">Doctest Blocks</a></li>
55
<li><a href="#tables">Tables</a></li>
56
<li><a href="#transitions">Transitions</a></li>
57
<li><a href="#explicit-markup">Explicit Markup</a>
59
<li><a href="#footnotes">Footnotes</a></li>
60
<li><a href="#citations">Citations</a></li>
61
<li><a href="#hyperlink-targets">Hyperlink Targets</a>
63
<li><a href="#external-hyperlink-targets">External Hyperlink Targets</a></li>
64
<li><a href="#internal-hyperlink-targets">Internal Hyperlink Targets</a></li>
65
<li><a href="#indirect-hyperlink-targets">Indirect Hyperlink Targets</a></li>
66
<li><a href="#implicit-hyperlink-targets">Implicit Hyperlink Targets</a></li>
68
<li><a href="#directives">Directives</a></li>
69
<li><a href="#substitution-references-and-definitions">Substitution References and Definitions</a></li>
70
<li><a href="#comments">Comments</a></li>
72
<li><a href="#getting-help">Getting Help</a></li>
75
<h2><a href="#contents" name="inline-markup" class="backref"
76
>Inline Markup</a></h2>
78
<p>(<a href="../../spec/rst/reStructuredText.html#inline-markup">details</a>)
80
<p>Inline markup allows words and phrases within text to have
81
character styles (like italics and boldface) and functionality
84
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
86
<tr align="left" bgcolor="#99CCFF">
93
<td nowrap><samp>*emphasis*</samp>
95
<td>Normally rendered as italics.
98
<td nowrap><samp>**strong emphasis**</samp>
99
<td><strong>strong emphasis</strong>
100
<td>Normally rendered as boldface.
103
<td nowrap><samp>`interpreted text`</samp>
104
<td>(see note at right)
105
<td>The rendering and <em>meaning</em> of interpreted text is
106
domain- or application-dependent. It can be used for things
107
like index entries or explicit descriptive markup (like program
111
<td nowrap><samp>``inline literal``</samp>
112
<td><code>inline literal</code>
113
<td>Normally rendered as monospaced text. Spaces should be
114
preserved, but line breaks will not be.
117
<td nowrap><samp>reference_</samp>
118
<td><a href="#hyperlink-targets">reference</a>
119
<td>A simple, one-word hyperlink reference. See <a
120
href="#hyperlinks" >Hyperlinks</a>.
123
<td nowrap><samp>`phrase reference`_</samp>
124
<td><a href="#hyperlink-targets">phrase reference</a>
125
<td>A hyperlink reference with spaces or punctuation needs to be
126
quoted with backquotes. See <a
127
href="#hyperlink-targets">Hyperlinks</a>.
130
<td nowrap><samp>anonymous__</samp>
131
<td><a href="#hyperlink-targets">anonymous</a>
132
<td>With two underscores instead of one, both simple and phrase
133
references may be anonymous (the reference text is not repeated
134
at the target). See <a
135
href="#hyperlink-targets">Hyperlinks</a>.
138
<td nowrap><samp>_`inline internal target`</samp>
139
<td><a name="inline-internal-target">inline internal target</a>
140
<td>A crossreference target within text.
141
See <a href="#hyperlink-targets">Hyperlinks</a>.
144
<td nowrap><samp>|substitution reference|</samp>
145
<td>(see note at right)
146
<td>The result is substituted in from the <a
147
href="#substitution-references-and-definitions">substitution
148
definition</a>. It could be text, an image, a hyperlink, or a
149
combination of these and others.
152
<td nowrap><samp>footnote reference [1]_</samp>
153
<td>footnote reference <sup><a href="#footnotes">1</a></sup>
154
<td>See <a href="#footnotes">Footnotes</a>.
157
<td nowrap><samp>citation reference [CIT2002]_</samp>
158
<td>citation reference <a href="#citations">[CIT2002]</a>
159
<td>See <a href="#citations">Citations</a>.
162
<td nowrap><samp>http://docutils.sf.net/</samp>
163
<td><a href="http://docutils.sf.net/">http://docutils.sf.net/</a>
164
<td>A standalone hyperlink.
168
<p>Asterisk, backquote, vertical bar, and underscore are inline
169
delimiter characters. Asterisk, backquote, and vertical bar act
170
like quote marks; matching characters surround the marked-up word
171
or phrase, whitespace or other quoting is required outside them,
172
and there can't be whitespace just inside them. If you want to use
173
inline delimiter characters literally, <a href="#escaping">escape
174
(with backslash)</a> or quote them (with double backquotes; i.e.
175
use inline literals).
177
<p>In detail, the reStructuredText specification says that in
178
inline markup, the following rules apply to start-strings and
179
end-strings (inline markup delimiters):
182
<li>The start-string must start a text block or be
183
immediately preceded by whitespace or any of
184
<samp>' " ( [ {</samp> or <samp><</samp>.
185
<li>The start-string must be immediately followed by non-whitespace.
186
<li>The end-string must be immediately preceded by non-whitespace.
187
<li>The end-string must end a text block (end of document or
188
followed by a blank line) or be immediately followed by whitespace
189
or any of <samp>' " . , : ; ! ? - ) ] } / \</samp>
190
or <samp>></samp>.
191
<li>If a start-string is immediately preceded by one of
192
<samp>' " ( [ {</samp> or <samp><</samp>, it must not be
193
immediately followed by the corresponding character from
194
<samp>' " ) ] }</samp> or <samp>></samp>.
195
<li>An end-string must be separated by at least one
196
character from the start-string.
197
<li>An <a href="#escaping">unescaped</a> backslash preceding a
198
start-string or end-string will disable markup recognition, except
199
for the end-string of inline literals.
202
<p>Also remember that inline markup may not be nested (well,
203
except that inline literals can contain any of the other inline
204
markup delimiter characters, but that doesn't count because
205
nothing is processed).
207
<h2><a href="#contents" name="escaping" class="backref"
208
>Escaping with Backslashes</a></h2>
211
href="../../spec/rst/reStructuredText.html#escaping-mechanism">details</a>)
213
<p>reStructuredText uses backslashes ("\") to override the special
214
meaning given to markup characters and get the literal characters
215
themselves. To get a literal backslash, use an escaped backslash
218
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
220
<tr align="left" bgcolor="#99CCFF">
221
<th width="50%">Raw reStructuredText
222
<th width="50%">Typical result
225
<tr valign="top"><td>
226
<samp>*escape* ``with`` "\"</samp>
227
<td><em>escape</em> <samp>with</samp> ""
228
<tr valign="top"><td>
229
<samp>\*escape* \``with`` "\\"</samp>
230
<td>*escape* ``with`` "\"
233
<p>In Python strings it will, of course, be necessary
234
to escape any backslash characters so that they actually
235
<em>reach</em> reStructuredText.
236
The simplest way to do this is to use raw strings:
238
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
240
<tr align="left" bgcolor="#99CCFF">
241
<th width="50%">Python string
242
<th width="50%">Typical result
245
<tr valign="top"><td>
246
<samp>r"""\*escape* \`with` "\\""""</samp>
247
<td>*escape* `with` "\"
248
<tr valign="top"><td>
249
<samp> """\\*escape* \\`with` "\\\\""""</samp>
250
<td>*escape* `with` "\"
251
<tr valign="top"><td>
252
<samp> """\*escape* \`with` "\\""""</samp>
253
<td><em>escape</em> with ""
256
<h2><a href="#contents" name="section-structure" class="backref"
257
>Section Structure</a></h2>
259
<p>(<a href="../../spec/rst/reStructuredText.html#sections">details</a>)
261
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
263
<tr align="left" bgcolor="#99CCFF">
264
<th width="50%">Plain text
265
<th width="50%">Typical result
271
<br><samp>Title</samp>
272
<br><samp>=====</samp>
273
<br><samp>Subtitle</samp>
274
<br><samp>--------</samp>
275
<br><samp>Titles are underlined (or over-</samp>
276
<br><samp>and underlined) with a printing</samp>
277
<br><samp>nonalphanumeric 7-bit ASCII</samp>
278
<br><samp>character. Recommended choices</samp>
279
<br><samp>are "``= - ` : ' " ~ ^ _ * + # < >``".</samp>
280
<br><samp>The underline/overline must be at</samp>
281
<br><samp>least as long as the title text.</samp>
284
<font size="+2"><strong>Title</strong></font>
285
<p><font size="+1"><strong>Subtitle</strong></font>
286
<p>Titles are underlined (or over-
287
and underlined) with a printing
288
nonalphanumeric 7-bit ASCII
289
character. Recommended choices
290
are "<samp>= - ` : ' " ~ ^ _ * + # < ></samp>".
291
The underline/overline must be at
292
least as long as the title text.
295
<h2><a href="#contents" name="paragraphs" class="backref"
298
<p>(<a href="../../spec/rst/reStructuredText.html#paragraphs">details</a>)
300
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
302
<tr align="left" bgcolor="#99CCFF">
303
<th width="50%">Plain text
304
<th width="50%">Typical result
309
<p><samp>This is a paragraph.</samp>
311
<p><samp>Paragraphs line up at their left</samp>
312
<br><samp>edges, and are normally separated</samp>
313
<br><samp>by blank lines.</samp>
316
<p>This is a paragraph.
318
<p>Paragraphs line up at their left edges, and are normally
319
separated by blank lines.
323
<h2><a href="#contents" name="bullet-lists" class="backref"
324
>Bullet Lists</a></h2>
326
<p>(<a href="../../spec/rst/reStructuredText.html#bullet-lists">details</a>)
328
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
330
<tr align="left" bgcolor="#99CCFF">
331
<th width="50%">Plain text
332
<th width="50%">Typical result
337
<samp>Bullet lists:</samp>
339
<p><samp>- This is item 1</samp>
340
<br><samp>- This is item 2</samp>
342
<p><samp>- Bullets are "-", "*" or "+".</samp>
343
<br><samp> Continuing text must be aligned</samp>
344
<br><samp> after the bullet and whitespace.</samp>
346
<p><samp>Note that a blank line is required</samp>
347
<br><samp>before the first item and after the</samp>
348
<br><samp>last, but is optional between items.</samp>
353
<li>Bullets are "-", "*" or "+".
354
Continuing text must be aligned
355
after the bullet and whitespace.
357
<p>Note that a blank line is required before the first
358
item and after the last, but is optional between items.
361
<h2><a href="#contents" name="enumerated-lists" class="backref"
362
>Enumerated Lists</a></h2>
364
<p>(<a href="../../spec/rst/reStructuredText.html#enumerated-lists">details</a>)
366
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
368
<tr align="left" bgcolor="#99CCFF">
369
<th width="50%">Plain text
370
<th width="50%">Typical result
375
<samp>Enumerated lists:</samp>
377
<p><samp>3. This is the first item</samp>
378
<br><samp>4. This is the second item</samp>
379
<br><samp>5. Enumerators are arabic numbers,</samp>
380
<br><samp> single letters, or roman numerals</samp>
381
<br><samp>6. List items should be sequentially</samp>
382
<br><samp> numbered, but need not start at 1</samp>
383
<br><samp> (although not all formatters will</samp>
384
<br><samp> honour the first index).</samp>
385
<td>Enumerated lists:
387
<li value="3">This is the first item
388
<li>This is the second item
389
<li>Enumerators are arabic numbers, single letters,
391
<li>List items should be sequentially numbered,
392
but need not start at 1 (although not all
393
formatters will honour the first index).
397
<h2><a href="#contents" name="definition-lists" class="backref"
398
>Definition Lists</a></h2>
400
<p>(<a href="../../spec/rst/reStructuredText.html#definition-lists">details</a>)
402
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
404
<tr align="left" bgcolor="#99CCFF">
405
<th width="50%">Plain text
406
<th width="50%">Typical result
411
<samp>Definition lists:</samp>
413
<br><samp>what</samp>
414
<br><samp> Definition lists associate a term with</samp>
415
<br><samp> a definition.</samp>
418
<br><samp> The term is a one-line phrase, and the</samp>
419
<br><samp> definition is one or more paragraphs or</samp>
420
<br><samp> body elements, indented relative to the</samp>
421
<br><samp> term. Blank lines are not allowed</samp>
422
<br><samp> between term and definition.</samp>
423
<td>Definition lists:
425
<dt><strong>what</strong>
426
<dd>Definition lists associate a term with
429
<dt><strong>how</strong>
430
<dd>The term is a one-line phrase, and the
431
definition is one or more paragraphs or
432
body elements, indented relative to the
433
term. Blank lines are not allowed
434
between term and definition.
438
<h2><a href="#contents" name="field-lists" class="backref"
439
>Field Lists</a></h2>
441
<p>(<a href="../../spec/rst/reStructuredText.html#field-lists">details</a>)
443
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
445
<tr align="left" bgcolor="#99CCFF">
446
<th width="50%">Plain text
447
<th width="50%">Typical result
452
<samp>:Authors:</samp>
453
<br><samp> Tony J. (Tibs) Ibbs,</samp>
454
<br><samp> David Goodger</samp>
456
<p><samp> (and sundry other good-natured folks)</samp>
458
<p><samp>:Version: 1.0 of 2001/08/08</samp>
459
<br><samp>:Dedication: To my father.</samp>
463
<td><strong>Authors:</strong>
464
<td>Tony J. (Tibs) Ibbs,
466
<tr><td><td>(and sundry other good-natured folks)
467
<tr><td><strong>Version:</strong><td>1.0 of 2001/08/08
468
<tr><td><strong>Dedication:</strong><td>To my father.
472
<p>Field lists are used as part of an extension syntax, such as
473
options for <a href="#directives">directives</a>, or database-like
474
records meant for further processing. Field lists may also be
475
used as generic two-column table constructs in documents.
477
<h2><a href="#contents" name="option-lists" class="backref"
478
>Option Lists</a></h2>
480
<p>(<a href="../../spec/rst/reStructuredText.html#option-lists">details</a>)
482
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
484
<tr align="left" bgcolor="#99CCFF">
485
<th width="50%">Plain text
486
<th width="50%">Typical result
492
-a command-line option "a"
493
<br>-b file options can have arguments
494
<br> and long descriptions
495
<br>--long options can be long also
496
<br>--input=file long options can also have
497
<br> arguments
498
<br>/V DOS/VMS-style options too
502
<table border="0" width="100%">
505
<td width="30%"><p><samp>-a</samp>
506
<td><p>command-line option "a"
508
<td><p><samp>-b <i>file</i></samp>
509
<td><p>options can have arguments and long descriptions
511
<td><p><samp>--long</samp>
512
<td><p>options can be long also
514
<td><p><samp>--input=<i>file</i></samp>
515
<td><p>long options can also have arguments
517
<td><p><samp>/V</samp>
518
<td><p>DOS/VMS-style options too
522
<p>There must be at least two spaces between the option and the
525
<h2><a href="#contents" name="literal-blocks" class="backref"
526
>Literal Blocks</a></h2>
528
<p>(<a href="../../spec/rst/reStructuredText.html#literal-blocks">details</a>)
530
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
532
<tr align="left" bgcolor="#99CCFF">
533
<th width="50%">Plain text
534
<th width="50%">Typical result
539
<samp>A paragraph containing only two colons</samp>
540
<br><samp>indicates that the following indented</samp>
541
<br><samp>or quoted text is a literal block.</samp>
545
<br><samp> Whitespace, newlines, blank lines, and</samp>
546
<br><samp> all kinds of markup (like *this* or</samp>
547
<br><samp> \this) is preserved by literal blocks.</samp>
549
<br><samp> The paragraph containing only '::'</samp>
550
<br><samp> will be omitted from the result.</samp>
552
<br><samp>The ``::`` may be tacked onto the very</samp>
553
<br><samp>end of any paragraph. The ``::`` will be</samp>
554
<br><samp>omitted if it is preceded by whitespace.</samp>
555
<br><samp>The ``::`` will be converted to a single</samp>
556
<br><samp>colon if preceded by text, like this::</samp>
558
<br><samp> It's very convenient to use this form.</samp>
560
<br><samp>Literal blocks end when text returns to</samp>
561
<br><samp>the preceding paragraph's indentation.</samp>
562
<br><samp>This means that something like this</samp>
563
<br><samp>is possible::</samp>
565
<br><samp> We start here</samp>
566
<br><samp> and continue here</samp>
567
<br><samp> and end here.</samp>
569
<br><samp>Per-line quoting can also be used on</samp>
570
<br><samp>unindented literal blocks:</samp>
572
<br><samp>> Useful for quotes from email and</samp>
573
<br><samp>> for Haskell literate programming.<samp>
576
<p>A paragraph containing only two colons
577
indicates that the following indented or quoted
578
text is a literal block.
581
Whitespace, newlines, blank lines, and
582
all kinds of markup (like *this* or
583
\this) is preserved by literal blocks.
585
The paragraph containing only '::'
586
will be omitted from the result.</pre>
588
<p>The <samp>::</samp> may be tacked onto the very
589
end of any paragraph. The <samp>::</samp> will be
590
omitted if it is preceded by whitespace.
591
The <samp>::</samp> will be converted to a single
592
colon if preceded by text, like this:
595
It's very convenient to use this form.</pre>
597
<p>Literal blocks end when text returns to
598
the preceding paragraph's indentation.
599
This means that something like this is possible:
606
<p>Per-line quoting can also be used on
607
unindented literal blocks:
610
> Useful for quotes from email and
611
> for Haskell literate programming.</pre>
614
<h2><a href="#contents" name="block-quotes" class="backref"
615
>Block Quotes</a></h2>
617
<p>(<a href="../../spec/rst/reStructuredText.html#block-quotes">details</a>)
619
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
621
<tr align="left" bgcolor="#99CCFF">
622
<th width="50%">Plain text
623
<th width="50%">Typical result
628
<samp>Block quotes are just:</samp>
630
<p><samp> Indented paragraphs,</samp>
632
<p><samp> and they may nest.</samp>
634
Block quotes are just:
636
<p>Indented paragraphs,
638
<p>and they may nest.
643
<h2><a href="#contents" name="doctest-blocks" class="backref"
644
>Doctest Blocks</a></h2>
646
<p>(<a href="../../spec/rst/reStructuredText.html#doctest-blocks">details</a>)
648
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
650
<tr align="left" bgcolor="#99CCFF">
651
<th width="50%">Plain text
652
<th width="50%">Typical result
657
<p><samp>Doctest blocks are interactive
658
<br>Python sessions. They begin with
659
<br>"``>>>``" and end with a blank line.</samp>
661
<p><samp>>>> print "This is a doctest block."
662
<br>This is a doctest block.</samp>
665
<p>Doctest blocks are interactive
666
Python sessions. They begin with
667
"<samp>>>></samp>" and end with a blank line.
669
<p><samp>>>> print "This is a doctest block."
670
<br>This is a doctest block.</samp>
674
href="http://www.python.org/doc/current/lib/module-doctest.html">doctest</a>
675
module searches a module's docstrings for text that looks like an
676
interactive Python session, then executes all such sessions to
677
verify they still work exactly as shown." (From the doctest docs.)
679
<h2><a href="#contents" name="tables" class="backref"
682
<p>(<a href="../../spec/rst/reStructuredText.html#tables">details</a>)
684
<p>There are two syntaxes for tables in reStructuredText. Grid
685
tables are complete but cumbersome to create. Simple tables are
686
easy to create but limited (no row spans, etc.).</p>
688
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
690
<tr align="left" bgcolor="#99CCFF">
691
<th width="50%">Plain text
692
<th width="50%">Typical result
697
<p><samp>Grid table:</samp></p>
699
<p><samp>+------------+------------+-----------+</samp>
700
<br><samp>| Header 1 | Header 2 | Header 3 |</samp>
701
<br><samp>+============+============+===========+</samp>
702
<br><samp>| body row 1 | column 2 | column 3 |</samp>
703
<br><samp>+------------+------------+-----------+</samp>
704
<br><samp>| body row 2 | Cells may span columns.|</samp>
705
<br><samp>+------------+------------+-----------+</samp>
706
<br><samp>| body row 3 | Cells may | - Cells |</samp>
707
<br><samp>+------------+ span rows. | - contain |</samp>
708
<br><samp>| body row 4 | | - blocks. |</samp>
709
<br><samp>+------------+------------+-----------+</samp></p>
723
<td colspan="2">Cells may span columns.
726
<td rowspan="2">Cells may<br>span rows.
738
<p><samp>Simple table:</samp></p>
740
<p><samp>===== ===== ======</samp>
741
<br><samp> Inputs Output</samp>
742
<br><samp>------------ ------</samp>
743
<br><samp> A B A or B</samp>
744
<br><samp>===== ===== ======</samp>
745
<br><samp>False False False</samp>
746
<br><samp>True False True</samp>
747
<br><samp>False True True</samp>
748
<br><samp>True True True</samp>
749
<br><samp>===== ===== ======</samp></p>
753
<table frame="border" rules="all">
755
<col colwidth="31%" />
756
<col colwidth="31%" />
757
<col colwidth="38%" />
759
<thead valign="bottom">
761
<th colspan="2">Inputs
788
<h2><a href="#contents" name="transitions" class="backref"
789
>Transitions</a></h2>
791
<p>(<a href="../../spec/rst/reStructuredText.html#transitions">details</a>)
793
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
795
<tr align="left" bgcolor="#99CCFF">
796
<th width="50%">Plain text
797
<th width="50%">Typical result
803
A transition marker is a horizontal line
804
<br>of 4 or more repeated punctuation
805
<br>characters.</samp>
807
<p><samp>------------</samp>
809
<p><samp>A transition should not begin or end a
810
<br>section or document, nor should two
811
<br>transitions be immediately adjacent.</samp>
814
<p>A transition marker is a horizontal line
815
of 4 or more repeated punctuation
820
<p>A transition should not begin or end a
821
section or document, nor should two
822
transitions be immediately adjacent.
825
<p>Transitions are commonly seen in novels and short fiction, as a
826
gap spanning one or more lines, marking text divisions or
827
signaling changes in subject, time, point of view, or emphasis.
829
<h2><a href="#contents" name="explicit-markup" class="backref"
830
>Explicit Markup</a></h2>
832
<p>Explicit markup blocks are used for constructs which float
833
(footnotes), have no direct paper-document representation
834
(hyperlink targets, comments), or require specialized processing
835
(directives). They all begin with two periods and whitespace, the
836
"explicit markup start".
838
<h3><a href="#contents" name="footnotes" class="backref"
841
<p>(<a href="../../spec/rst/reStructuredText.html#footnotes">details</a>)
843
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
845
<tr align="left" bgcolor="#99CCFF">
846
<th width="50%">Plain text
847
<th width="50%">Typical result
853
<samp>Footnote references, like [5]_.</samp>
854
<br><samp>Note that footnotes may get</samp>
855
<br><samp>rearranged, e.g., to the bottom of</samp>
856
<br><samp>the "page".</samp>
858
<p><samp>.. [5] A numerical footnote. Note</samp>
859
<br><samp> there's no colon after the ``]``.</samp>
862
Footnote references, like <sup><a href="#5">5</a></sup>.
863
Note that footnotes may get rearranged, e.g., to the bottom of
867
<tr><td colspan="2"><hr>
868
<!-- <tr><td colspan="2">Footnotes: -->
869
<tr><td><a name="5"><strong>[5]</strong></a><td> A numerical footnote.
870
Note there's no colon after the <samp>]</samp>.
875
<samp>Autonumbered footnotes are</samp>
876
<br><samp>possible, like using [#]_ and [#]_.</samp>
877
<p><samp>.. [#] This is the first one.</samp>
878
<br><samp>.. [#] This is the second one.</samp>
880
<p><samp>They may be assigned 'autonumber</samp>
881
<br><samp>labels' - for instance,
882
<br>[#fourth]_ and [#third]_.</samp>
884
<p><samp>.. [#third] a.k.a. third_</samp>
885
<p><samp>.. [#fourth] a.k.a. fourth_</samp>
887
Autonumbered footnotes are possible, like using <sup><a
888
href="#auto1">1</a></sup> and <sup><a href="#auto2">2</a></sup>.
890
<p>They may be assigned 'autonumber labels' - for instance,
891
<sup><a href="#fourth">4</a></sup> and <sup><a
892
href="#third">3</a></sup>.
895
<tr><td colspan="2"><hr>
896
<!-- <tr><td colspan="2">Footnotes: -->
897
<tr><td><a name="auto1"><strong>[1]</strong></a><td> This is the first one.
898
<tr><td><a name="auto2"><strong>[2]</strong></a><td> This is the second one.
899
<tr><td><a name="third"><strong>[3]</strong></a><td> a.k.a. <a href="#third">third</a>
900
<tr><td><a name="fourth"><strong>[4]</strong></a><td> a.k.a. <a href="#fourth">fourth</a>
905
<samp>Auto-symbol footnotes are also</samp>
906
<br><samp>possible, like this: [*]_ and [*]_.</samp>
907
<p><samp>.. [*] This is the first one.</samp>
908
<br><samp>.. [*] This is the second one.</samp>
911
Auto-symbol footnotes are also
912
possible, like this: <sup><a href="#symbol1">*</a></sup>
913
and <sup><a href="#symbol2">†</a></sup>.
916
<tr><td colspan="2"><hr>
917
<!-- <tr><td colspan="2">Footnotes: -->
918
<tr><td><a name="symbol1"><strong>[*]</strong></a><td> This is the first symbol footnote
919
<tr><td><a name="symbol2"><strong>[†]</strong></a><td> This is the second one.
924
<p>The numbering of auto-numbered footnotes is determined by the
925
order of the footnotes, not of the references. For auto-numbered
926
footnote references without autonumber labels
927
("<samp>[#]_</samp>"), the references and footnotes must be in the
928
same relative order. Similarly for auto-symbol footnotes
929
("<samp>[*]_</samp>").
931
<h3><a href="#contents" name="citations" class="backref"
934
<p>(<a href="../../spec/rst/reStructuredText.html#citations">details</a>)
936
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
938
<tr align="left" bgcolor="#99CCFF">
939
<th width="50%">Plain text
940
<th width="50%">Typical result
946
<samp>Citation references, like [CIT2002]_.</samp>
947
<br><samp>Note that citations may get</samp>
948
<br><samp>rearranged, e.g., to the bottom of</samp>
949
<br><samp>the "page".</samp>
951
<p><samp>.. [CIT2002] A citation</samp>
952
<br><samp> (as often used in journals).</samp>
954
<p><samp>Citation labels contain alphanumerics,</samp>
955
<br><samp>underlines, hyphens and fullstops.</samp>
956
<br><samp>Case is not significant.</samp>
958
<p><samp>Given a citation like [this]_, one</samp>
959
<br><samp>can also refer to it like this_.</samp>
961
<p><samp>.. [this] here.</samp>
964
Citation references, like <a href="#cit2002">[CIT2002]</a>.
965
Note that citations may get rearranged, e.g., to the bottom of
968
<p>Citation labels contain alphanumerics, underlines, hyphens
969
and fullstops. Case is not significant.
971
<p>Given a citation like <a href="#this">[this]</a>, one
972
can also refer to it like <a href="#this">this</a>.
975
<tr><td colspan="2"><hr>
976
<!-- <tr><td colspan="2">Citations: -->
977
<tr><td><a name="cit2002"><strong>[CIT2002]</strong></a><td> A citation
978
(as often used in journals).
979
<tr><td><a name="this"><strong>[this]</strong></a><td> here.
984
<h3><a href="#contents" name="hyperlink-targets" class="backref"
985
>Hyperlink Targets</a></h3>
987
<p>(<a href="../../spec/rst/reStructuredText.html#hyperlink-targets">details</a>)
989
<h4><a href="#contents" name="external-hyperlink-targets" class="backref"
990
>External Hyperlink Targets</a></h4>
992
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
994
<tr align="left" bgcolor="#99CCFF">
995
<th width="50%">Plain text
996
<th width="50%">Typical result
1002
<samp>External hyperlinks, like Python_.</samp>
1004
<p><samp>.. _Python: http://www.python.org/</samp>
1006
<table width="100%">
1007
<tr bgcolor="#99CCFF"><td><em>Fold-in form</em>
1008
<tr><td>Indirect hyperlinks, like
1009
<a href="http://www.python.org">Python</a>.
1010
<tr bgcolor="#99CCFF"><td><em>Call-out form</em>
1011
<tr><td>External hyperlinks, like
1012
<a href="#labPython"><i>Python</i></a>.
1015
<tr><td colspan="2"><hr>
1016
<tr><td><a name="labPython"><i>Python:</i></a>
1017
<td> <a href="http://www.python.org/">http://www.python.org/</a>
1022
<p>"<em>Fold-in</em>" is the representation typically used in HTML
1023
documents (think of the indirect hyperlink being "folded in" like
1024
ingredients into a cake), and "<em>call-out</em>" is more suitable for
1025
printed documents, where the link needs to be presented explicitly, for
1026
example as a footnote.
1028
<h4><a href="#contents" name="internal-hyperlink-targets" class="backref"
1029
>Internal Hyperlink Targets</a></h4>
1031
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
1033
<tr align="left" bgcolor="#99CCFF">
1034
<th width="50%">Plain text
1035
<th width="50%">Typical result
1040
<td><samp>Internal crossreferences, like example_.</samp>
1042
<p><samp>.. _example:</samp>
1044
<p><samp>This is an example crossreference target.</samp>
1046
<table width="100%">
1047
<tr bgcolor="#99CCFF"><td><em>Fold-in form</em>
1048
<!-- Note that some browsers may not like an "a" tag that -->
1049
<!-- does not have any content, so we could arbitrarily -->
1050
<!-- use the first word as content - *or* just trust to -->
1052
<tr><td>Internal crossreferences, like <a href="#example-foldin">example</a>
1053
<p><a name="example-foldin">This</a> is an example
1054
crossreference target.
1055
<tr><td bgcolor="#99CCFF"><em>Call-out form</em>
1056
<tr><td>Internal crossreferences, like <a href="#example-callout">example</a>
1058
<p><a name="example-callout"><i>example:</i></a>
1059
<br>This is an example crossreference target.
1064
<h4><a href="#contents" name="indirect-hyperlink-targets" class="backref"
1065
>Indirect Hyperlink Targets</a></h4>
1067
<p>(<a href="../../spec/rst/reStructuredText.html#indirect-hyperlink-targets">details</a>)
1069
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
1071
<tr align="left" bgcolor="#99CCFF">
1072
<th width="50%">Plain text
1073
<th width="50%">Typical result
1079
<samp>Python_ is `my favourite
1080
<br>programming language`__.</samp>
1082
<p><samp>.. _Python: http://www.python.org/</samp>
1084
<p><samp>__ Python_</samp>
1087
<p><a href="http://www.python.org/">Python</a> is
1088
<a href="http://www.python.org/">my favourite
1089
programming language</a>.
1093
<p>The second hyperlink target (the line beginning with
1094
"<samp>__</samp>") is both an indirect hyperlink target
1095
(<i>indirectly</i> pointing at the Python website via the
1096
"<samp>Python_</samp>" reference) and an <b>anonymous hyperlink
1097
target</b>. In the text, a double-underscore suffix is used to
1098
indicate an <b>anonymous hyperlink reference</b>. In an anonymous
1099
hyperlink target, the reference text is not repeated. This is
1100
useful for references with long text or throw-away references, but
1101
the target should be kept close to the reference to prevent them
1104
<h4><a href="#contents" name="implicit-hyperlink-targets" class="backref"
1105
>Implicit Hyperlink Targets</a></h4>
1107
<p>(<a href="../../spec/rst/reStructuredText.html#implicit-hyperlink-targets">details</a>)
1109
<p>Section titles, footnotes, and citations automatically generate
1110
hyperlink targets (the title text or footnote/citation label is
1111
used as the hyperlink name).
1113
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3"> <tr align="left" bgcolor="#99CCFF">
1114
<th width="50%">Plain text
1115
<th width="50%">Typical result
1121
<samp>Titles are targets, too</samp>
1122
<br><samp>=======================</samp>
1123
<br><samp>Implict references, like `Titles are</samp>
1124
<br><samp>targets, too`_.</samp>
1126
<font size="+2"><strong><a name="title">Titles are targets, too</a></strong></font>
1127
<p>Implict references, like <a href="#Title">Titles are
1131
<h3><a href="#contents" name="directives" class="backref"
1132
>Directives</a></h3>
1134
<p>(<a href="../../spec/rst/reStructuredText.html#directives">details</a>)
1136
<p>Directives are a general-purpose extension mechanism, a way of
1137
adding support for new constructs without adding new syntax. For
1138
a description of all standard directives, see <a
1139
href="../../spec/rst/directives.html" >reStructuredText
1142
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
1144
<tr align="left" bgcolor="#99CCFF">
1145
<th width="50%">Plain text
1146
<th width="50%">Typical result
1150
<td><samp>For instance:</samp>
1152
<p><samp>.. image:: images/ball1.gif</samp>
1156
<p><img src="images/ball1.gif" alt="ball1">
1159
<h3><a href="#contents" name="substitution-references-and-definitions"
1160
class="backref" >Substitution References and Definitions</a></h3>
1162
<p>(<a href="../../spec/rst/reStructuredText.html#substitution-definitions">details</a>)
1164
<p>Substitutions are like inline directives, allowing graphics and
1165
arbitrary constructs within text.
1167
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
1169
<tr align="left" bgcolor="#99CCFF">
1170
<th width="50%">Plain text
1171
<th width="50%">Typical result
1176
The |biohazard| symbol must be
1177
used on containers used to
1178
dispose of medical waste.</samp>
1181
.. |biohazard| image:: biohazard.png</samp>
1185
<p>The <img src="images/biohazard.png" align="bottom" alt="biohazard"> symbol
1186
must be used on containers used to dispose of medical waste.
1190
<h3><a href="#contents" name="comments" class="backref"
1193
<p>(<a href="../../spec/rst/reStructuredText.html#comments">details</a>)
1195
<p>Any text which begins with an explicit markup start but doesn't
1196
use the syntax of any of the constructs above, is a comment.
1198
<p><table border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
1200
<tr align="left" bgcolor="#99CCFF">
1201
<th width="50%">Plain text
1202
<th width="50%">Typical result
1206
<td><samp>.. This text will not be shown</samp>
1207
<br><samp> (but, for instance, in HTML might be</samp>
1208
<br><samp> rendered as an HTML comment)</samp>
1211
<!-- This text will not be shown -->
1212
<!-- (but, for instance in HTML might be -->
1213
<!-- rendered as an HTML comment) -->
1217
<samp>An empty "comment" does not</samp>
1218
<br><samp>"consume" following blocks.</samp>
1220
<p><samp> So this block is not "lost",</samp>
1221
<br><samp> despite its indentation.</samp>
1223
An empty "comment" does not
1224
"consume" following blocks.
1226
So this block is not "lost",
1227
despite its indentation.
1231
<h2><a href="#contents" name="getting-help" class="backref"
1232
>Getting Help</a></h2>
1234
<p>Users who have questions or need assistance with Docutils or
1235
reStructuredText should <a
1236
href="mailto:docutils-users@lists.sourceforge.net" >post a
1237
message</a> to the <a
1238
href="http://lists.sourceforge.net/lists/listinfo/docutils-users"
1239
>Docutils-Users mailing list</a>. The <a
1240
href="http://docutils.sourceforge.net/" >Docutils project web
1241
site</a> has more information.
1246
<a href="http://www.tibsnjoan.co.uk/">Tibs</a>
1247
(<a href="mailto:tibs@tibsnjoan.co.uk"><tt>tibs@tibsnjoan.co.uk</tt></a>)
1249
(<a href="mailto:goodger@python.org">goodger@python.org</a>)
1251
<!-- Created: Fri Aug 03 09:11:57 GMT Daylight Time 2001 -->