1 .. This is a comment. Note how any initial comments are moved by
2 transforms to after the document title, subtitle, and docinfo.
6 ================================
7 reStructuredText Test Document
8 ================================
10 .. Above is the document title, and below is the subtitle.
11 They are transformed from section titles after parsing.
15 --------------------------------
16 Examples of Syntax Constructs
17 --------------------------------
19 .. bibliographic fields (which also require a transform):
21 :Author: David Goodger
22 :Address: 123 Example Street
25 :Contact: goodger@python.org
26 :Authors: Me; Myself; I
27 :organization: humankind
28 :date: Now, or yesterday. Or maybe even *before* yesterday.
29 :status: This is a "work in progress"
30 :revision: is managed by a version control system.
32 :copyright: This document has been placed in the public domain. You
33 may do with it as you wish. You may copy, modify,
34 redistribute, reattribute, sell, buy, rent, lease,
35 destroy, or improve it, quote it at length, excerpt,
36 incorporate, collate, fold, staple, or mutilate it, or do
37 anything else to it that your or anyone else's heart
39 :field name: This is a "generic bibliographic field".
41 Generic bibliographic fields may contain multiple body elements.
47 For Docutils users & co-developers.
51 This is a test document, containing at least one example of each
52 reStructuredText construct.
55 :keywords: reStructuredText, test, parser
56 :description lang=en: A test document, containing at least one
57 example of each reStructuredText construct.
61 \pagebreak[4] % start ToC on new page
63 .. contents:: Table of Contents
64 .. section-numbering::
75 Lone subsections are converted to a section subtitle by a transform
76 activated with the ``--section-subtitles`` command line option or the
77 ``sectsubtitle-xform`` configuration value.
89 It divides the section. Transitions may also occur between sections:
104 Paragraphs contain text and may contain inline markup: *emphasis*,
105 **strong emphasis**, ``inline literals``, standalone hyperlinks
106 (http://www.python.org), external hyperlinks (Python_), internal
107 cross-references (example_), external hyperlinks with embedded URIs
108 (`Python web site <http://www.python.org>`__), `anonymous hyperlink
109 references`__ (`a second reference`__), footnote references (manually
110 numbered [1]_, anonymous auto-numbered [#]_, labeled auto-numbered
111 [#label]_, or symbolic [*]_), citation references ([CIT2002]_),
112 substitution references (|example|), and _`inline hyperlink targets`
113 (see Targets_ below for a reference back to here). Character-level
114 inline markup is also possible (although exceedingly ugly!) in *re*\
115 ``Structured``\ *Text*. Problems are indicated by |problematic| text
116 (generated by processing errors; this one is intentional). Here is a
117 reference to the doctitle_ and the subtitle_.
119 __ http://www.python.org/
120 __ http://docutils.sourceforge.net/
122 The default role for interpreted text is `Title Reference`. Here are
123 some explicit interpreted text roles: a PEP reference (:PEP:`287`); an
124 RFC reference (:RFC:`2822`); a :sub:`subscript`; a :sup:`superscript`;
125 and explicit roles for :emphasis:`standard` :strong:`inline`
128 .. DO NOT RE-WRAP THE FOLLOWING PARAGRAPH!
130 Let's test wrapping and whitespace significance in inline literals:
131 ``This is an example of --inline-literal --text, --including some--
132 strangely--hyphenated-words. Adjust-the-width-of-your-browser-window
133 to see how the text is wrapped. -- ---- -------- Now note the
134 spacing between the words of this sentence (words
135 should be grouped in pairs).``
137 If the ``--pep-references`` option was supplied, there should be a
138 live link to PEP 258 here.
145 + Nested bullet list.
150 Paragraph 2 of item 2.
152 * Nested bullet list.
160 * This nested list should be compacted by the HTML writer.
164 .. Even if this item contains a target and a comment.
179 2. Lists that don't start at 1:
199 Definition paragraph 1.
201 Definition paragraph 2.
204 Term : classifier one : classifier two
210 :what: Field lists map field names to field bodies, like database
211 records. They are often part of an extension syntax. They are
212 an unambiguous variant of RFC 2822 fields.
216 The field marker is a colon, the field name, and a colon.
218 The field body may contain one or more body elements, indented
219 relative to the field marker.
225 This paragraph has the `credits` class set. (This is actually not
226 about credits but just for ensuring that the class attribute
227 doesn't get stripped away.)
232 For listing command-line options:
234 -a command-line option "a"
235 -b file options can have arguments
236 and long descriptions
237 --long options can be long also
238 --input=file long options can also have
242 The description can also start on the next line.
244 The description may contain multiple body elements,
245 regardless of where it starts.
247 -x, -y, -z Multiple options are an "option group".
248 -v, --verbose Commonly-seen: short & long options.
249 -1 file, --one=file, --two file
250 Multiple options with arguments.
251 /V DOS/VMS-style options too
253 There must be at least two spaces between the option and the
259 Literal blocks are indicated with a double-colon ("::") at the end of
260 the preceding paragraph (over there ``-->``). They can be indented::
263 text = 'is left as-is'
264 spaces_and_linebreaks = 'are preserved'
265 markup_processing = None
267 Or they can be quoted without indentation::
271 > Why didn't I think of that?
276 This section tests line blocks. Line blocks are body elements which
277 consist of lines and other line blocks. Nested line blocks cause
280 | This is a line block. It ends with a blank line.
281 | New lines begin with a vertical bar ("|").
282 | Line breaks and initial indent are significant, and preserved.
283 | Continuation lines are also possible. A long line that is intended
284 to wrap should begin with a space in place of the vertical bar.
285 | The left edge of a continuation line need not be aligned with
286 the left edge of the text above it.
288 | This is a second line block.
290 | Blank lines are permitted internally, but they must begin with a "|".
292 Another line block, surrounded by paragraphs:
294 | And it's no good waiting by the window
295 | It's no good waiting for the sun
296 | Please believe me, the things you dream of
297 | They don't fall in the lap of no-one
299 Take it away, Eric the Orchestra Leader!
301 | A one, two, a one two three four
303 | Half a bee, philosophically,
304 | must, *ipso facto*, half not be.
305 | But half the bee has got to be,
306 | *vis a vis* its entity. D'you see?
308 | But can a bee be said to be
309 | or not to be an entire bee,
310 | when half the bee is not a bee,
311 | due to some ancient injury?
315 A line block, like the following poem by Christian Morgenstern, can
316 also be centre-aligned:
318 .. class:: language-de align-center
322 | Zwei Trichter wandeln durch die Nacht.
323 | Durch ihres Rumpfs verengten Schacht
324 | fließt weißes Mondlicht
335 Block quotes consist of indented body elements:
337 My theory by A. Elk. Brackets Miss, brackets. This theory goes
338 as follows and begins now. All brontosauruses are thin at one
339 end, much much thicker in the middle and then thin again at the
340 far end. That is my theory, it is mine, and belongs to me and I
341 own it, and what it is too.
345 The language of a quote (like any other object) can be specified by
348 .. class:: language-fr
352 ReStructuredText est un langage de balisage léger utilisé
353 notamment dans la documentation du langage Python.
358 >>> print 'Python-specific usage examples; begun with ">>>"'
359 Python-specific usage examples; begun with ">>>"
360 >>> print '(cut and pasted from interactive Python sessions)'
361 (cut and pasted from interactive Python sessions)
366 .. [1] A footnote contains body elements, consistently indented by at
369 This is the footnote's second paragraph.
371 .. [#label] Footnotes may be numbered, either manually (as in [1]_) or
372 automatically using a "#"-prefixed label. This footnote has a
373 label so it can be referred to from multiple places, both as a
374 footnote reference ([#label]_) and as a `hyperlink reference`__.
378 .. [#] This footnote is numbered automatically and anonymously using a
381 This is the second paragraph.
383 And this is the third paragraph.
385 .. [*] Footnotes may also use symbols, specified with a "*" label.
386 Here's a reference to the next footnote: [*]_.
388 .. [*] This footnote shows the next symbol in the sequence.
390 .. [4] Here's an unreferenced footnote, with a reference to a
391 nonexistent footnote: [5]_.
396 .. [CIT2002] Citations are text-labeled footnotes. They may be
397 rendered separately and differently from footnotes.
399 Here's a reference to the above, [CIT2002]_, and a [nonexistent]_
409 This paragraph is pointed to by the explicit "example" target. A
410 reference can be found under `Inline Markup`_, above. `Inline
411 hyperlink targets`_ are also possible.
413 Section headers are implicit targets, referred to by name. See
414 Targets_, which is a subsection of `Body Elements`_.
416 Explicit external targets are interpolated into references such as
419 .. _Python: http://www.python.org/
421 Targets may be indirect and anonymous. Thus `this phrase`__ may also
422 refer to the Targets_ section.
426 Here's a `hyperlink reference without a target`_, which generates an
429 Duplicate Target Names
430 ``````````````````````
432 Duplicate names in section headers or other implicit targets will
433 generate "info" (level-1) system messages. Duplicate names in
434 explicit targets will generate "warning" (level-2) system messages.
436 Duplicate Target Names
437 ``````````````````````
439 Since there are two "Duplicate Target Names" section headers, we
440 cannot uniquely refer to either of them by name. If we try to (like
441 this: `Duplicate Target Names`_), an error is generated.
446 .. contents:: :local:
448 These are just a sample of the many reStructuredText Directives. For
450 http://docutils.sourceforge.net/docs/ref/rst/directives.html.
455 An example of the "contents" directive can be seen above this section
456 (a local, untitled table of contents_) and at the beginning of the
457 document (a document-wide `table of contents`_).
462 An image directive (also clickable -- a hyperlink reference):
464 .. image:: ../../../docs/user/rst/images/title.png
465 :class: class1 class2
468 Image with multiple IDs:
473 .. image:: ../../../docs/user/rst/images/title.png
477 .. image:: ../../../docs/user/rst/images/biohazard.png
480 A left-aligned image:
482 .. image:: ../../../docs/user/rst/images/biohazard.png
485 This paragraph might flow around the image.
486 The specific behavior depends upon the style sheet and
487 the browser or rendering software used.
489 A right-aligned image:
491 .. image:: ../../../docs/user/rst/images/biohazard.png
494 This paragraph might flow around the image.
495 The specific behavior depends upon the style sheet and
496 the browser or rendering software used.
498 For inline images see `Substitution Definitions`_.
504 .. image:: ../../../docs/user/rst/images/biohazard.png
507 An image 2 em wide and 15 pixel high:
509 .. image:: ../../../docs/user/rst/images/biohazard.png
513 An image occupying 50% of the line width:
515 .. image:: ../../../docs/user/rst/images/title.png
520 .. image:: ../../../docs/user/rst/images/biohazard.png
523 A *figure* is an image with a caption and/or a legend. With page-based output
524 media, figures might float to a different position if this helps the page
527 .. figure:: ../../../docs/user/rst/images/title.png
528 :figclass: figclass1 figclass2
529 :class: class1 class2
530 :alt: reStructuredText, the markup syntax
533 Plaintext markup syntax and parser system.
535 +------------+-----------------------------------------------+
536 | re | Revised, revisited, based on 're' module. |
537 +------------+-----------------------------------------------+
538 | Structured | Structure-enhanced text, structuredtext. |
539 +------------+-----------------------------------------------+
540 | Text | Well it is, isn't it? |
541 +------------+-----------------------------------------------+
543 This paragraph is also part of the legend.
545 A left-aligned figure:
547 .. figure:: ../../../docs/user/rst/images/biohazard.png
548 :figclass: figclass1 figclass2
549 :class: class1 class2
550 :alt: reStructuredText, the markup syntax
559 The legend may consist of several paragraphs.
561 This paragraph might flow around the figure.
563 The specific behavior depends upon the style sheet and the browser or
564 rendering software used.
568 .. figure:: ../../../docs/user/rst/images/biohazard.png
576 The legend may consist of several paragraphs.
578 This paragraph might flow around the figure.
580 The specific behavior depends upon the style sheet and the browser or
581 rendering software used.
583 A right-aligned figure:
585 .. figure:: ../../../docs/user/rst/images/biohazard.png
593 The legend may consist of several paragraphs.
595 This paragraph might flow around the figure. The specific behavior depends
596 upon the style sheet and the browser or rendering software used.
602 .. Attention:: Directives at large.
606 Don't take any wooden nickels.
608 .. DANGER:: Mad scientist at work!
610 .. Error:: Does not compute.
612 .. Hint:: It's bigger than a bread box.
615 - Wash behind your ears.
616 - Clean up your room.
620 .. Note:: This is a note.
622 .. Tip:: 15% if the service is good.
624 .. WARNING:: Strong prose may provoke extreme mental exertion.
625 Reader discretion is strongly advised.
627 .. admonition:: And, by the way...
629 You can make up your own admonition too.
631 .. _Docutils: http://docutils.sourceforge.net/
633 Topics, Sidebars, and Rubrics
634 `````````````````````````````
636 *Sidebars* are like miniature, parallel documents.
638 .. sidebar:: Sidebar Title
639 :subtitle: Optional Subtitle
641 This is a sidebar. It is for text outside the flow of the main
644 .. rubric:: This is a rubric inside a sidebar
646 Sidebars often appear beside the main text with a border and a different
647 background or font color.
649 A *topic* is like a block quote with a title, or a self-contained section
652 .. topic:: Topic Title
656 A *rubric* is like an informal heading that doesn't correspond to the
657 document's structure. It is typically highlighted in red (hence the name).
659 .. rubric:: This is a rubric
661 Topics and rubrics can be used at places where a `section title`_ is not
662 allowed (e.g. inside a directive).
673 I recommend you try |Python|_.
675 .. |Python| replace:: Python, *the* best language around
683 Compound 1, paragraph 1.
685 Compound 1, paragraph 2.
687 * Compound 1, list item one.
688 * Compound 1, list item two.
690 Another compound statement:
694 Compound 2, a literal block::
698 Compound 2, this is a test.
702 Compound 3, only consisting of one paragraph.
709 This one starts with a literal block.
711 Compound 4, a paragraph.
713 Now something *really* perverted -- a nested compound block. This is
714 just to test that it works at all; the results don't have to be
719 Compound 5, block 1 (a paragraph).
723 Compound 6, block 2 in compound 5.
725 Compound 6, another paragraph.
727 Compound 5, block 3 (a paragraph).
731 Compound 7, with a table inside:
733 +--------------------+--------------------+--------------------+
734 | Left cell, first | Middle cell, | Right cell. |
735 | paragraph. | consisting of | |
736 | | exactly one | Paragraph 2. |
737 | Left cell, second | paragraph. | |
738 | paragraph. | | Paragraph 3. |
739 +--------------------+--------------------+--------------------+
741 Compound 7, a paragraph after the table.
743 Compound 7, another paragraph.
745 Parsed Literal Blocks
746 `````````````````````
750 This is a parsed literal block.
751 This line is indented. The next line is blank.
753 Inline markup is supported, e.g. *emphasis*, **strong**, ``literal
754 text``, footnotes [1]_, _`hyperlink targets`, and `references
755 <http://www.python.org/>`_.
757 Substitution Definitions
758 ------------------------
760 An inline image (|example|) example:
762 .. |EXAMPLE| image:: ../../../docs/user/rst/images/biohazard.png
764 (Substitution definitions are not visible in the HTML source.)
771 .. Comments begin with two dots and a space. Anything may
772 follow, except for the syntax of footnotes, hyperlink
773 targets, directives, or substitution definitions.
775 Double-dashes -- "--" -- must be escaped somehow in HTML output.
777 Comments may contain non-ASCII characters: ä ö ü æ ø å
779 (View the HTML source to see the comment.)
784 This does not necessarily look nice, because there may be missing white space.
786 It's just there to freeze the behavior.
800 Another test with myclass set.
802 .. role:: raw-role(raw)
804 :class: myrawroleclass
806 This is the :raw-role:`fourth test` with myrawroleclass set.
810 Fifth test in HTML.<br />Line two.
814 Fifth test in LaTeX.\\Line two.
819 .. container:: custom