Fix #268 wrong synonym for sectnum directive in docs.
[docutils.git] / docutils / docs / ref / rst / directives.txt
blob582b5d0a307430d024723c4342b94ea1a19d7be9
1 =============================
2  reStructuredText Directives
3 =============================
4 :Author: David Goodger
5 :Contact: docutils-develop@lists.sourceforge.net
6 :Revision: $Revision$
7 :Date: $Date$
8 :Copyright: This document has been placed in the public domain.
10 .. contents::
12 This document describes the directives implemented in the reference
13 reStructuredText parser.
15 Directives have the following syntax::
17     +-------+-------------------------------+
18     | ".. " | directive type "::" directive |
19     +-------+ block                         |
20             |                               |
21             +-------------------------------+
23 Directives begin with an explicit markup start (two periods and a
24 space), followed by the directive type and two colons (collectively,
25 the "directive marker").  The directive block begins immediately after
26 the directive marker, and includes all subsequent indented lines.  The
27 directive block is divided into arguments, options (a field list), and
28 content (in that order), any of which may appear.  See the Directives_
29 section in the `reStructuredText Markup Specification`_ for syntax
30 details.
32 Descriptions below list "doctree elements" (document tree element
33 names; XML DTD generic identifiers) corresponding to individual
34 directives.  For details on the hierarchy of elements, please see `The
35 Docutils Document Tree`_ and the `Docutils Generic DTD`_ XML document
36 type definition.  For directive implementation details, see `Creating
37 reStructuredText Directives`_.
39 .. _Directives: restructuredtext.html#directives
40 .. _reStructuredText Markup Specification: restructuredtext.html
41 .. _The Docutils Document Tree: ../doctree.html
42 .. _Docutils Generic DTD: ../docutils.dtd
43 .. _Creating reStructuredText Directives:
44    ../../howto/rst-directives.html
47 -------------
48  Admonitions
49 -------------
51 .. _attention:
52 .. _caution:
53 .. _danger:
54 .. _error:
55 .. _hint:
56 .. _important:
57 .. _note:
58 .. _tip:
59 .. _warning:
61 Specific Admonitions
62 ====================
64 :Directive Types: "attention", "caution", "danger", "error", "hint",
65                   "important", "note", "tip", "warning", "admonition"
66 :Doctree Elements: attention, caution, danger, error, hint, important,
67                    note, tip, warning, admonition_, title
68 :Directive Arguments: None.
69 :Directive Options: `:class:`_, `:name:`_
70 :Directive Content: Interpreted as body elements.
72 Admonitions are specially marked "topics" that can appear anywhere an
73 ordinary body element can.  They contain arbitrary body elements.
74 Typically, an admonition is rendered as an offset block in a document,
75 sometimes outlined or shaded, with a title matching the admonition
76 type.  For example::
78     .. DANGER::
79        Beware killer rabbits!
81 This directive might be rendered something like this::
83     +------------------------+
84     |        !DANGER!        |
85     |                        |
86     | Beware killer rabbits! |
87     +------------------------+
89 The following admonition directives have been implemented:
91 - attention
92 - caution
93 - danger
94 - error
95 - hint
96 - important
97 - note
98 - tip
99 - warning
101 Any text immediately following the directive indicator (on the same
102 line and/or indented on following lines) is interpreted as a directive
103 block and is parsed for normal body elements.  For example, the
104 following "note" admonition directive contains one paragraph and a
105 bullet list consisting of two list items::
107     .. note:: This is a note admonition.
108        This is the second line of the first paragraph.
110        - The note contains all indented body elements
111          following.
112        - It includes this bullet list.
115 Generic Admonition
116 ==================
118 :Directive Type: "admonition"
119 :Doctree Elements: admonition_, title
120 :Directive Arguments: One, required (admonition title)
121 :Directive Options: Possible, see below.
122 :Directive Content: Interpreted as body elements.
124 This is a generic, titled admonition.  The title may be anything the
125 author desires.
127 The author-supplied title is also used as a `"classes"`_ attribute value
128 after being converted into a valid identifier form (down-cased;
129 non-alphanumeric characters converted to single hyphens; "admonition-"
130 prefixed).  For example, this admonition::
132     .. admonition:: And, by the way...
134        You can make up your own admonition too.
136 becomes the following document tree (pseudo-XML)::
138     <document source="test data">
139         <admonition classes="admonition-and-by-the-way">
140             <title>
141                 And, by the way...
142             <paragraph>
143                 You can make up your own admonition too.
145 The `common options`_ are recognized:
147 ``class`` : text
148     Overrides the computed `"classes"`_ attribute value.
150 ``name`` : text
151   Add `text` to the `"names"`_ attribute of the admonition element.
154 --------
155  Images
156 --------
158 There are two image directives: "image" and "figure".
161 Image
162 =====
164 :Directive Type: "image"
165 :Doctree Element: image_
166 :Directive Arguments: One, required (image URI).
167 :Directive Options: Possible.
168 :Directive Content: None.
170 An "image" is a simple picture::
172     .. image:: picture.png
174 Inline images can be defined with an "image" directive in a `substitution
175 definition`_
177 The URI for the image source file is specified in the directive
178 argument.  As with hyperlink targets, the image URI may begin on the
179 same line as the explicit markup start and target name, or it may
180 begin in an indented text block immediately following, with no
181 intervening blank lines.  If there are multiple lines in the link
182 block, they are stripped of leading and trailing whitespace and joined
183 together.
185 Optionally, the image link block may contain a flat field list, the
186 _`image options`.  For example::
188     .. image:: picture.jpeg
189        :height: 100px
190        :width: 200 px
191        :scale: 50 %
192        :alt: alternate text
193        :align: right
195 The following options are recognized:
197 ``alt`` : text
198     Alternate text: a short description of the image, displayed by
199     applications that cannot display images, or spoken by applications
200     for visually impaired users.
202 ``height`` : `length`_
203     The desired height of the image.
204     Used to reserve space or scale the image vertically.  When the "scale"
205     option is also specified, they are combined.  For example, a height of
206     200px and a scale of 50 is equivalent to a height of 100px with no scale.
208 ``width`` : `length`_ or `percentage`_ of the current line width
209     The width of the image.
210     Used to reserve space or scale the image horizontally.  As with "height"
211     above, when the "scale" option is also specified, they are combined.
213     .. _length: restructuredtext.html#length-units
214     .. _percentage: restructuredtext.html#percentage-units
216 ``scale`` : integer percentage (the "%" symbol is optional)
217     The uniform scaling factor of the image.  The default is "100 %", i.e.
218     no scaling.
220     If no "height" or "width" options are specified, the `Python Imaging
221     Library`_ (PIL) may be used to determine them, if it is installed and
222     the image file is available.
224 ``align`` : "top", "middle", "bottom", "left", "center", or "right"
225     The alignment of the image, equivalent to the HTML ``<img>`` tag's
226     "align" attribute.  The values "top", "middle", and "bottom"
227     control an image's vertical alignment (relative to the text
228     baseline); they are only useful for inline images (substitutions).
229     The values "left", "center", and "right" control an image's
230     horizontal alignment, allowing the image to float and have the
231     text flow around it.  The specific behavior depends upon the
232     browser or rendering software used.
234 ``target`` : text (URI or reference name)
235     Makes the image into a hyperlink reference ("clickable").  The
236     option argument may be a URI (relative or absolute), or a
237     `reference name`_ with underscore suffix (e.g. ```a name`_``).
239 and the common options `:class:`_ and `:name:`_.
241 .. _substitution definition: restructuredtext.html#substitution-definitions
244 Figure
245 ======
247 :Directive Type: "figure"
248 :Doctree Elements: figure_, image_, caption_, legend_
249 :Directive Arguments: One, required (image URI).
250 :Directive Options: Possible.
251 :Directive Content: Interpreted as the figure caption and an optional
252                     legend.
254 A "figure" consists of image_ data (including `image options`_), an optional
255 caption (a single paragraph), and an optional legend (arbitrary body
256 elements). For page-based output media, figures might float to a different
257 position if this helps the page layout.
260     .. figure:: picture.png
261        :scale: 50 %
262        :alt: map to buried treasure
264        This is the caption of the figure (a simple paragraph).
266        The legend consists of all elements after the caption.  In this
267        case, the legend consists of this paragraph and the following
268        table:
270        +-----------------------+-----------------------+
271        | Symbol                | Meaning               |
272        +=======================+=======================+
273        | .. image:: tent.png   | Campground            |
274        +-----------------------+-----------------------+
275        | .. image:: waves.png  | Lake                  |
276        +-----------------------+-----------------------+
277        | .. image:: peak.png   | Mountain              |
278        +-----------------------+-----------------------+
280 There must be blank lines before the caption paragraph and before the
281 legend.  To specify a legend without a caption, use an empty comment
282 ("..") in place of the caption.
284 The "figure" directive supports all of the options of the "image"
285 directive (see `image options`_ above). These options (except
286 "align") are passed on to the contained image.
288 ``align`` : "left", "center", or "right"
289     The horizontal alignment of the figure, allowing the image to
290     float and have the text flow around it.  The specific behavior
291     depends upon the browser or rendering software used.
293 In addition, the following options are recognized:
295 ``figwidth`` : "image", length_, or percentage_ of current line width
296     The width of the figure.
297     Limits the horizontal space used by the figure.
298     A special value of "image" is allowed, in which case the
299     included image's actual width is used (requires the `Python Imaging
300     Library`_). If the image file is not found or the required software is
301     unavailable, this option is ignored.
303     Sets the "width" attribute of the "figure" doctree element.
305     This option does not scale the included image; use the "width"
306     `image`_ option for that. ::
308         +---------------------------+
309         |        figure             |
310         |                           |
311         |<------ figwidth --------->|
312         |                           |
313         |  +---------------------+  |
314         |  |     image           |  |
315         |  |                     |  |
316         |  |<--- width --------->|  |
317         |  +---------------------+  |
318         |                           |
319         |The figure's caption should|
320         |wrap at this width.        |
321         +---------------------------+
323 ``figclass`` : text
324     Set a `"classes"`_ attribute value on the figure element.  See the
325     class_ directive below.
327 .. _Python Imaging Library: http://www.pythonware.com/products/pil/
330 ---------------
331  Body Elements
332 ---------------
334 Topic
335 =====
337 :Directive Type: "topic"
338 :Doctree Element: topic_
339 :Directive Arguments: 1, required (topic title).
340 :Directive Options: `:class:`_, `:name:`_
341 :Directive Content: Interpreted as the topic body.
343 A topic is like a block quote with a title, or a self-contained
344 section with no subsections.  Use the "topic" directive to indicate a
345 self-contained idea that is separate from the flow of the document.
346 Topics may occur anywhere a section or transition may occur.  Body
347 elements and topics may not contain nested topics.
349 The directive's sole argument is interpreted as the topic title; the
350 next line must be blank.  All subsequent lines make up the topic body,
351 interpreted as body elements.  For example::
353     .. topic:: Topic Title
355         Subsequent indented lines comprise
356         the body of the topic, and are
357         interpreted as body elements.
360 Sidebar
361 =======
363 :Directive Type: "sidebar"
364 :Doctree Element: sidebar_
365 :Directive Arguments: One, required (sidebar title).
366 :Directive Options: Possible (see below).
367 :Directive Content: Interpreted as the sidebar body.
369 Sidebars are like miniature, parallel documents that occur inside
370 other documents, providing related or reference material.  A sidebar
371 is typically offset by a border and "floats" to the side of the page;
372 the document's main text may flow around it.  Sidebars can also be
373 likened to super-footnotes; their content is outside of the flow of
374 the document's main text.
376 Sidebars may occur anywhere a section or transition may occur.  Body
377 elements (including sidebars) may not contain nested sidebars.
379 The directive's sole argument is interpreted as the sidebar title,
380 which may be followed by a subtitle option (see below); the next line
381 must be blank.  All subsequent lines make up the sidebar body,
382 interpreted as body elements.  For example::
384     .. sidebar:: Sidebar Title
385        :subtitle: Optional Sidebar Subtitle
387        Subsequent indented lines comprise
388        the body of the sidebar, and are
389        interpreted as body elements.
391 The following options are recognized:
393 ``subtitle`` : text
394     The sidebar's subtitle.
396 and the common options `:class:`_ and `:name:`_.
399 Line Block
400 ==========
402 .. admonition:: Deprecated
404    The "line-block" directive is deprecated.  Use the `line block
405    syntax`_ instead.
407    .. _line block syntax: restructuredtext.html#line-blocks
409 :Directive Type: "line-block"
410 :Doctree Element: line_block_
411 :Directive Arguments: None.
412 :Directive Options: `:class:`_, `:name:`_
413 :Directive Content: Becomes the body of the line block.
415 The "line-block" directive constructs an element where line breaks and
416 initial indentation is significant and inline markup is supported.  It
417 is equivalent to a `parsed literal block`_ with different rendering:
418 typically in an ordinary serif typeface instead of a
419 typewriter/monospaced face, and not automatically indented.  (Have the
420 line-block directive begin a block quote to get an indented line
421 block.)  Line blocks are useful for address blocks and verse (poetry,
422 song lyrics), where the structure of lines is significant.  For
423 example, here's a classic::
425     "To Ma Own Beloved Lassie: A Poem on her 17th Birthday", by
426     Ewan McTeagle (for Lassie O'Shea):
428         .. line-block::
430             Lend us a couple of bob till Thursday.
431             I'm absolutely skint.
432             But I'm expecting a postal order and I can pay you back
433                 as soon as it comes.
434             Love, Ewan.
438 .. _parsed-literal:
440 Parsed Literal Block
441 ====================
443 :Directive Type: "parsed-literal"
444 :Doctree Element: literal_block_
445 :Directive Arguments: None.
446 :Directive Options: `:class:`_, `:name:`_
447 :Directive Content: Becomes the body of the literal block.
449 Unlike an ordinary literal block, the "parsed-literal" directive
450 constructs a literal block where the text is parsed for inline markup.
451 It is equivalent to a `line block`_ with different rendering:
452 typically in a typewriter/monospaced typeface, like an ordinary
453 literal block.  Parsed literal blocks are useful for adding hyperlinks
454 to code examples.
456 However, care must be taken with the text, because inline markup is
457 recognized and there is no protection from parsing.  Backslash-escapes
458 may be necessary to prevent unintended parsing.  And because the
459 markup characters are removed by the parser, care must also be taken
460 with vertical alignment.  Parsed "ASCII art" is tricky, and extra
461 whitespace may be necessary.
463 For example, all the element names in this content model are links::
465     .. parsed-literal::
467        ( (title_, subtitle_?)?,
468          decoration_?,
469          (docinfo_, transition_?)?,
470          `%structure.model;`_ )
472 Code
473 ====
475 :Directive Type: "code"
476 :Doctree Element: literal_block_, `inline elements`_
477 :Directive Arguments: One, optional (formal language).
478 :Directive Options: name, class, number-lines.
479 :Directive Content: Becomes the body of the literal block.
480 :Configuration Setting: syntax_highlight_.
482 (New in Docutils 0.9)
484 The "code" directive constructs a literal block. If the code language is
485 specified, the content is parsed by the Pygments_ syntax highlighter and
486 tokens are stored in nested `inline elements`_ with class arguments
487 according to their syntactic category. The actual highlighting requires
488 a style-sheet (e.g. one `generated by Pygments`__, see the
489 `sandbox/stylesheets`__ for examples).
491 The parsing can be turned off with the syntax_highlight_ configuration
492 setting and command line option or by specifying the language as `:class:`_
493 option instead of directive argument. This also avoids warnings
494 when Pygments_ is not installed or the language is not in the
495 `supported languages and markup formats`_.
497 For inline code, use the `"code" role`_.
499 __ http://pygments.org/docs/cmdline/#generating-styles
500 __ http://docutils.sourceforge.net/sandbox/stylesheets/
501 .. _Pygments: http://pygments.org/
502 .. _syntax_highlight: ../../user/config.html#syntax-highlight
503 .. _supported languages and markup formats: http://pygments.org/languages/
504 .. _"code" role: roles.html#code
507 The following options are recognized:
509 ``number-lines`` : [start line number]
510     Precede every line with a line number.
511     The optional argument is the number of the first line (defaut 1).
513 and the common options `:class:`_ and `:name:`_.
515 Example::
516   The content of the following directive ::
518     .. code:: python
520       def my_function():
521           "just a test"
522           print 8/2
524   is parsed and marked up as Python source code.
527 Math
528 ====
530 :Directive Type: "math"
531 :Doctree Element: math_block_
532 :Directive Arguments: One, optional: prepended to content.
533 :Directive Options: `:class:`_, `:name:`_
534 :Directive Content: Interpreted as math block(s).
535                     Content blocks separated by a blank line are put in
536                     separate math-block doctree elements.
537 :Configuration Setting: math_output_
539 (New in Docutils 0.8)
541 The "math" directive inserts blocks with mathematical content
542 (display formulas, equations) into the document. The input format is
543 *LaTeX math syntax*\ [#math-syntax]_ with support for Unicode
544 symbols, for example::
546   .. math::
548     α_t(i) = P(O_1, O_2, … O_t, q_t = S_i λ)
550 Support is limited to a subset of *LaTeX math* by the conversion
551 required for many output formats.  For HTML, the the `math_output`_
552 configuration setting (or the corresponding ``--math-output``
553 command line option) select between alternative output formats with
554 different subsets of supported elements. If a writer does not
555 support math typesetting at all, the content is inserted verbatim.
557 .. [#math-syntax] The supported LaTeX commands include AMS extensions
558    (see, e.g., the `Short Math Guide`_).
561 For inline math, use the `"math" role`_.
563 .. _Short Math Guide: ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf
564 .. _"math" role: roles.html#math
565 .. _math_output: ../../user/config.html#math-output
567 Rubric
568 ======
570 :Directive Type: "rubric"
571 :Doctree Element: rubric_
572 :Directive Arguments: 1, required (rubric text).
573 :Directive Options: `:class:`_, `:name:`_
574 :Directive Content: None.
578      rubric n. 1. a title, heading, or the like, in a manuscript,
579      book, statute, etc., written or printed in red or otherwise
580      distinguished from the rest of the text. ...
582      -- Random House Webster's College Dictionary, 1991
584 The "rubric" directive inserts a "rubric" element into the document
585 tree.  A rubric is like an informal heading that doesn't correspond to
586 the document's structure.
589 Epigraph
590 ========
592 :Directive Type: "epigraph"
593 :Doctree Element: block_quote_
594 :Directive Arguments: None.
595 :Directive Options: None.
596 :Directive Content: Interpreted as the body of the block quote.
598 An epigraph is an apposite (suitable, apt, or pertinent) short
599 inscription, often a quotation or poem, at the beginning of a document
600 or section.
602 The "epigraph" directive produces an "epigraph"-class block quote.
603 For example, this input::
605      .. epigraph::
607         No matter where you go, there you are.
609         -- Buckaroo Banzai
611 becomes this document tree fragment::
613     <block_quote classes="epigraph">
614         <paragraph>
615             No matter where you go, there you are.
616         <attribution>
617             Buckaroo Banzai
620 Highlights
621 ==========
623 :Directive Type: "highlights"
624 :Doctree Element: block_quote_
625 :Directive Arguments: None.
626 :Directive Options: None.
627 :Directive Content: Interpreted as the body of the block quote.
629 Highlights summarize the main points of a document or section, often
630 consisting of a list.
632 The "highlights" directive produces a "highlights"-class block quote.
633 See Epigraph_ above for an analogous example.
636 Pull-Quote
637 ==========
639 :Directive Type: "pull-quote"
640 :Doctree Element: block_quote_
641 :Directive Arguments: None.
642 :Directive Options: None.
643 :Directive Content: Interpreted as the body of the block quote.
645 A pull-quote is a small selection of text "pulled out and quoted",
646 typically in a larger typeface.  Pull-quotes are used to attract
647 attention, especially in long articles.
649 The "pull-quote" directive produces a "pull-quote"-class block quote.
650 See Epigraph_ above for an analogous example.
653 Compound Paragraph
654 ==================
656 :Directive Type: "compound"
657 :Doctree Element: compound_
658 :Directive Arguments: None.
659 :Directive Options: `:class:`_, `:name:`_
660 :Directive Content: Interpreted as body elements.
662 (New in Docutils 0.3.6)
664 The "compound" directive is used to create a compound paragraph, which
665 is a single logical paragraph containing multiple physical body
666 elements such as simple paragraphs, literal blocks, tables, lists,
667 etc., instead of directly containing text and inline elements.  For
668 example::
670     .. compound::
672        The 'rm' command is very dangerous.  If you are logged
673        in as root and enter ::
675            cd /
676            rm -rf *
678        you will erase the entire contents of your file system.
680 In the example above, a literal block is "embedded" within a sentence
681 that begins in one physical paragraph and ends in another.
683 .. note::
685    The "compound" directive is *not* a generic block-level container
686    like HTML's ``<div>`` element.  Do not use it only to group a
687    sequence of elements, or you may get unexpected results.
689    If you need a generic block-level container, please use the
690    container_ directive, described below.
692 Compound paragraphs are typically rendered as multiple distinct text
693 blocks, with the possibility of variations to emphasize their logical
694 unity:
696 * If paragraphs are rendered with a first-line indent, only the first
697   physical paragraph of a compound paragraph should have that indent
698   -- second and further physical paragraphs should omit the indents;
699 * vertical spacing between physical elements may be reduced;
700 * and so on.
703 Container
704 =========
706 :Directive Type: "container"
707 :Doctree Element: container_
708 :Directive Arguments: One or more, optional (class names).
709 :Directive Options: `:name:`_
710 :Directive Content: Interpreted as body elements.
712 (New in Docutils 0.3.10)
714 The "container" directive surrounds its contents (arbitrary body
715 elements) with a generic block-level "container" element.  Combined
716 with the optional "classes_" attribute argument(s), this is an
717 extension mechanism for users & applications.  For example::
719     .. container:: custom
721        This paragraph might be rendered in a custom way.
723 Parsing the above results in the following pseudo-XML::
725     <container classes="custom">
726         <paragraph>
727             This paragraph might be rendered in a custom way.
729 The "container" directive is the equivalent of HTML's ``<div>``
730 element.  It may be used to group a sequence of elements for user- or
731 application-specific purposes.
735 --------
736  Tables
737 --------
739 Formal tables need more structure than the reStructuredText syntax
740 supplies.  Tables may be given titles with the table_ directive.
741 Sometimes reStructuredText tables are inconvenient to write, or table
742 data in a standard format is readily available.  The csv-table_
743 directive supports CSV data.
746 Table
747 =====
749 :Directive Type: "table"
750 :Doctree Element: table_
751 :Directive Arguments: 1, optional (table title).
752 :Directive Options: `:class:`_, `:name:`_
753 :Directive Content: A normal reStructuredText table.
755 (New in Docutils 0.3.1)
757 The "table" directive is used to create a titled table, to associate a
758 title with a table::
760     .. table:: Truth table for "not"
762        =====  =====
763          A    not A
764        =====  =====
765        False  True
766        True   False
767        =====  =====
770 .. _csv-table:
772 CSV Table
773 =========
775 :Directive Type: "csv-table"
776 :Doctree Element: table_
777 :Directive Arguments: 1, optional (table title).
778 :Directive Options: Possible (see below).
779 :Directive Content: A CSV (comma-separated values) table.
781 .. WARNING::
783    The "csv-table" directive's ":file:" and ":url:" options represent
784    a potential security holes.  They can be disabled with the
785    "file_insertion_enabled_" runtime setting.
787 (New in Docutils 0.3.4)
789 The "csv-table" directive is used to create a table from CSV
790 (comma-separated values) data.  CSV is a common data format generated
791 by spreadsheet applications and commercial databases.  The data may be
792 internal (an integral part of the document) or external (a separate
793 file).
795 Example::
797     .. csv-table:: Frozen Delights!
798        :header: "Treat", "Quantity", "Description"
799        :widths: 15, 10, 30
801        "Albatross", 2.99, "On a stick!"
802        "Crunchy Frog", 1.49, "If we took the bones out, it wouldn't be
803        crunchy, now would it?"
804        "Gannet Ripple", 1.99, "On a stick!"
806 Block markup and inline markup within cells is supported.  Line ends
807 are recognized within cells.
809 Working limitations:
811 * There is no support for checking that the number of columns in each
812   row is the same.  However, this directive supports CSV generators
813   that do not insert "empty" entries at the end of short rows, by
814   automatically adding empty entries.
816   .. Add "strict" option to verify input?
818 .. [#whitespace-delim] Whitespace delimiters are supported only for external
819    CSV files.
821 .. [#ASCII-char] With Python 2, the valuess for the ``delimiter``,
822    ``quote``, and ``escape`` options must be ASCII characters. (The csv
823    module does not support Unicode and all non-ASCII characters are
824    encoded as multi-byte utf-8 string). This limitation does not exist
825    under Python 3.
827 The following options are recognized:
829 ``widths`` : integer [, integer...]
830     A comma- or space-separated list of relative column widths.  The
831     default is equal-width columns (100%/#columns).
833 ``header-rows`` : integer
834     The number of rows of CSV data to use in the table header.
835     Defaults to 0.
837 ``stub-columns`` : integer
838     The number of table columns to use as stubs (row titles, on the
839     left).  Defaults to 0.
841 ``header`` : CSV data
842     Supplemental data for the table header, added independently of and
843     before any ``header-rows`` from the main CSV data.  Must use the
844     same CSV format as the main CSV data.
846 ``file`` : string (newlines removed)
847     The local filesystem path to a CSV data file.
849 ``url`` : string (whitespace removed)
850     An Internet URL reference to a CSV data file.
852 ``encoding`` : name of text encoding
853     The text encoding of the external CSV data (file or URL).
854     Defaults to the document's encoding (if specified).
856 ``delim`` : char | "tab" | "space" [#whitespace-delim]_
857     A one-character string\ [#ASCII-char]_ used to separate fields.
858     Defaults to ``,`` (comma).  May be specified as a Unicode code
859     point; see the unicode_ directive for syntax details.
861 ``quote`` : char
862     A one-character string\ [#ASCII-char]_ used to quote elements
863     containing the delimiter or which start with the quote
864     character.  Defaults to ``"`` (quote).  May be specified as a
865     Unicode code point; see the unicode_ directive for syntax
866     details.
868 ``keepspace`` : flag
869     Treat whitespace immediately following the delimiter as
870     significant.  The default is to ignore such whitespace.
872 ``escape`` : char
873     A one-character\ [#ASCII-char]_ string used to escape the
874     delimiter or quote characters.  May be specified as a Unicode
875     code point; see the unicode_ directive for syntax details.  Used
876     when the delimiter is used in an unquoted field, or when quote
877     characters are used within a field.  The default is to double-up
878     the character, e.g. "He said, ""Hi!"""
880     .. Add another possible value, "double", to explicitly indicate
881        the default case?
883 and the common options `:class:`_ and `:name:`_.
886 List Table
887 ==========
889 :Directive Type: "list-table"
890 :Doctree Element: table_
891 :Directive Arguments: 1, optional (table title).
892 :Directive Options: Possible (see below).
893 :Directive Content: A uniform two-level bullet list.
895 (New in Docutils 0.3.8.  This is an initial implementation; `further
896 ideas`__ may be implemented in the future.)
898 __ ../../dev/rst/alternatives.html#list-driven-tables
900 The "list-table" directive is used to create a table from data in a
901 uniform two-level bullet list.  "Uniform" means that each sublist
902 (second-level list) must contain the same number of list items.
904 Example::
906     .. list-table:: Frozen Delights!
907        :widths: 15 10 30
908        :header-rows: 1
910        * - Treat
911          - Quantity
912          - Description
913        * - Albatross
914          - 2.99
915          - On a stick!
916        * - Crunchy Frog
917          - 1.49
918          - If we took the bones out, it wouldn't be
919            crunchy, now would it?
920        * - Gannet Ripple
921          - 1.99
922          - On a stick!
924 The following options are recognized:
926 ``widths`` : integer [integer...]
927     A comma- or space-separated list of relative column widths.  The
928     default is equal-width columns (100%/#columns).
930 ``header-rows`` : integer
931     The number of rows of list data to use in the table header.
932     Defaults to 0.
934 ``stub-columns`` : integer
935     The number of table columns to use as stubs (row titles, on the
936     left).  Defaults to 0.
938 and the common options `:class:`_ and `:name:`_.
941 ----------------
942  Document Parts
943 ----------------
945 .. _contents:
947 Table of Contents
948 =================
950 :Directive Type: "contents"
951 :Doctree Elements: pending_, topic_
952 :Directive Arguments: One, optional: title.
953 :Directive Options: Possible.
954 :Directive Content: None.
956 The "contents" directive generates a table of contents (TOC) in a
957 topic_.  Topics, and therefore tables of contents, may occur anywhere
958 a section or transition may occur.  Body elements and topics may not
959 contain tables of contents.
961 Here's the directive in its simplest form::
963     .. contents::
965 Language-dependent boilerplate text will be used for the title.  The
966 English default title text is "Contents".
968 An explicit title may be specified::
970     .. contents:: Table of Contents
972 The title may span lines, although it is not recommended::
974     .. contents:: Here's a very long Table of
975        Contents title
977 Options may be specified for the directive, using a field list::
979     .. contents:: Table of Contents
980        :depth: 2
982 If the default title is to be used, the options field list may begin
983 on the same line as the directive marker::
985     .. contents:: :depth: 2
987 The following options are recognized:
989 ``depth`` : integer
990     The number of section levels that are collected in the table of
991     contents.  The default is unlimited depth.
993 ``local`` : flag (empty)
994     Generate a local table of contents.  Entries will only include
995     subsections of the section in which the directive is given.  If no
996     explicit title is given, the table of contents will not be titled.
998 ``backlinks`` : "entry" or "top" or "none"
999     Generate links from section headers back to the table of contents
1000     entries, the table of contents itself, or generate no backlinks.
1002 ``class`` : text
1003     Set a `"classes"`_ attribute value on the topic element.  See the
1004     class_ directive below.
1007 .. _sectnum:
1008 .. _section-numbering:
1010 Automatic Section Numbering
1011 ===========================
1013 :Directive Type: "sectnum" or "section-numbering" (synonyms)
1014 :Doctree Elements: pending_, generated_
1015 :Directive Arguments: None.
1016 :Directive Options: Possible.
1017 :Directive Content: None.
1018 :Configuration Setting: sectnum_xform_
1020 The "sectnum" (or "section-numbering") directive automatically numbers
1021 sections and subsections in a document (if not disabled by the
1022 ``--no-section-numbering`` command line option or the `sectnum_xform`_
1023 configuration setting).
1025 Section numbers are of the "multiple enumeration" form, where each
1026 level has a number, separated by periods.  For example, the title of section
1027 1, subsection 2, subsubsection 3 would have "1.2.3" prefixed.
1029 The "sectnum" directive does its work in two passes: the initial parse
1030 and a transform.  During the initial parse, a "pending" element is
1031 generated which acts as a placeholder, storing any options internally.
1032 At a later stage in the processing, the "pending" element triggers a
1033 transform, which adds section numbers to titles.  Section numbers are
1034 enclosed in a "generated" element, and titles have their "auto"
1035 attribute set to "1".
1037 The following options are recognized:
1039 ``depth`` : integer
1040     The number of section levels that are numbered by this directive.
1041     The default is unlimited depth.
1043 ``prefix`` : string
1044     An arbitrary string that is prefixed to the automatically
1045     generated section numbers.  It may be something like "3.2.", which
1046     will produce "3.2.1", "3.2.2", "3.2.2.1", and so on.  Note that
1047     any separating punctuation (in the example, a period, ".") must be
1048     explicitly provided.  The default is no prefix.
1050 ``suffix`` : string
1051     An arbitrary string that is appended to the automatically
1052     generated section numbers.  The default is no suffix.
1054 ``start`` : integer
1055     The value that will be used for the first section number.
1056     Combined with ``prefix``, this may be used to force the right
1057     numbering for a document split over several source files.  The
1058     default is 1.
1060 .. _sectnum_xform: ../../user/config.html#sectnum-xform
1063 .. _header:
1064 .. _footer:
1066 Document Header & Footer
1067 ========================
1069 :Directive Types: "header" and "footer"
1070 :Doctree Elements: decoration_, header, footer
1071 :Directive Arguments: None.
1072 :Directive Options: None.
1073 :Directive Content: Interpreted as body elements.
1075 (New in Docutils 0.3.8)
1077 The "header" and "footer" directives create document decorations,
1078 useful for page navigation, notes, time/datestamp, etc.  For example::
1080     .. header:: This space for rent.
1082 This will add a paragraph to the document header, which will appear at
1083 the top of the generated web page or at the top of every printed page.
1085 These directives may be used multiple times, cumulatively.  There is
1086 currently support for only one header and footer.
1088 .. note::
1090    While it is possible to use the "header" and "footer" directives to
1091    create navigational elements for web pages, you should be aware
1092    that Docutils is meant to be used for *document* processing, and
1093    that a navigation bar is not typically part of a document.
1095    Thus, you may soon find Docutils' abilities to be insufficient for
1096    these purposes.  At that time, you should consider using a
1097    documentation generator like Sphinx_ rather than the "header" and
1098    "footer" directives.
1100    .. _Sphinx: http://sphinx-doc.org/
1102 In addition to the use of these directives to populate header and
1103 footer content, content may also be added automatically by the
1104 processing system.  For example, if certain runtime settings are
1105 enabled, the document footer is populated with processing information
1106 such as a datestamp, a link to `the Docutils website`_, etc.
1108 .. _the Docutils website: http://docutils.sourceforge.net
1111 ------------
1112  References
1113 ------------
1115 .. _target-notes:
1117 Target Footnotes
1118 ================
1120 :Directive Type: "target-notes"
1121 :Doctree Elements: pending_, footnote_, footnote_reference_
1122 :Directive Arguments: None.
1123 :Directive Options: `:class:`_, `:name:`_
1124 :Directive Options: Possible.
1125 :Directive Content: None.
1127 The "target-notes" directive creates a footnote for each external
1128 target in the text, and corresponding footnote references after each
1129 reference.  For every explicit target (of the form, ``.. _target name:
1130 URL``) in the text, a footnote will be generated containing the
1131 visible URL as content.
1134 Footnotes
1135 =========
1137 **NOT IMPLEMENTED YET**
1139 :Directive Type: "footnotes"
1140 :Doctree Elements: pending_, topic_
1141 :Directive Arguments: None?
1142 :Directive Options: Possible?
1143 :Directive Content: None.
1148 Citations
1149 =========
1151 **NOT IMPLEMENTED YET**
1153 :Directive Type: "citations"
1154 :Doctree Elements: pending_, topic_
1155 :Directive Arguments: None?
1156 :Directive Options: Possible?
1157 :Directive Content: None.
1162 ---------------
1163  HTML-Specific
1164 ---------------
1166 Meta
1167 ====
1169 :Directive Type: "meta"
1170 :Doctree Element: meta (non-standard)
1171 :Directive Arguments: None.
1172 :Directive Options: None.
1173 :Directive Content: Must contain a flat field list.
1175 The "meta" directive is used to specify HTML metadata stored in HTML
1176 META tags.  "Metadata" is data about data, in this case data about web
1177 pages.  Metadata is used to describe and classify web pages in the
1178 World Wide Web, in a form that is easy for search engines to extract
1179 and collate.
1181 Within the directive block, a flat field list provides the syntax for
1182 metadata.  The field name becomes the contents of the "name" attribute
1183 of the META tag, and the field body (interpreted as a single string
1184 without inline markup) becomes the contents of the "content"
1185 attribute.  For example::
1187     .. meta::
1188        :description: The reStructuredText plaintext markup language
1189        :keywords: plaintext, markup language
1191 This would be converted to the following HTML::
1193     <meta name="description"
1194         content="The reStructuredText plaintext markup language">
1195     <meta name="keywords" content="plaintext, markup language">
1197 Support for other META attributes ("http-equiv", "scheme", "lang",
1198 "dir") are provided through field arguments, which must be of the form
1199 "attr=value"::
1201     .. meta::
1202        :description lang=en: An amusing story
1203        :description lang=fr: Une histoire amusante
1205 And their HTML equivalents::
1207     <meta name="description" lang="en" content="An amusing story">
1208     <meta name="description" lang="fr" content="Une histoire amusante">
1210 Some META tags use an "http-equiv" attribute instead of the "name"
1211 attribute.  To specify "http-equiv" META tags, simply omit the name::
1213     .. meta::
1214        :http-equiv=Content-Type: text/html; charset=ISO-8859-1
1216 HTML equivalent::
1218     <meta http-equiv="Content-Type"
1219          content="text/html; charset=ISO-8859-1">
1222 Imagemap
1223 ========
1225 **NOT IMPLEMENTED YET**
1227 Non-standard element: imagemap.
1230 -----------------------------------------
1231  Directives for Substitution Definitions
1232 -----------------------------------------
1234 The directives in this section may only be used in substitution
1235 definitions.  They may not be used directly, in standalone context.
1236 The `image`_ directive may be used both in substitution definitions
1237 and in the standalone context.
1240 .. _replace:
1242 Replacement Text
1243 ================
1245 :Directive Type: "replace"
1246 :Doctree Element: Text & `inline elements`_
1247 :Directive Arguments: None.
1248 :Directive Options: None.
1249 :Directive Content: A single paragraph; may contain inline markup.
1251 The "replace" directive is used to indicate replacement text for a
1252 substitution reference.  It may be used within substitution
1253 definitions only.  For example, this directive can be used to expand
1254 abbreviations::
1256     .. |reST| replace:: reStructuredText
1258     Yes, |reST| is a long word, so I can't blame anyone for wanting to
1259     abbreviate it.
1261 As reStructuredText doesn't support nested inline markup, the only way
1262 to create a reference with styled text is to use substitutions with
1263 the "replace" directive::
1265     I recommend you try |Python|_.
1267     .. |Python| replace:: Python, *the* best language around
1268     .. _Python: http://www.python.org/
1271 .. _unicode:
1273 Unicode Character Codes
1274 =======================
1276 :Directive Type: "unicode"
1277 :Doctree Element: Text
1278 :Directive Arguments: One or more, required (Unicode character codes,
1279                       optional text, and comments).
1280 :Directive Options: Possible.
1281 :Directive Content: None.
1283 The "unicode" directive converts Unicode character codes (numerical
1284 values) to characters, and may be used in substitution definitions
1285 only.
1287 The arguments, separated by spaces, can be:
1289 * **character codes** as
1291   - decimal numbers or
1293   - hexadecimal numbers, prefixed by ``0x``, ``x``, ``\x``, ``U+``,
1294     ``u``, or ``\u`` or as XML-style hexadecimal character entities,
1295     e.g. ``&#x1a2b;``
1297 * **text**, which is used as-is.
1299 Text following " .. " is a comment and is ignored.  The spaces between
1300 the arguments are ignored and thus do not appear in the output.
1301 Hexadecimal codes are case-insensitive.
1303 For example, the following text::
1305     Copyright |copy| 2003, |BogusMegaCorp (TM)| |---|
1306     all rights reserved.
1308     .. |copy| unicode:: 0xA9 .. copyright sign
1309     .. |BogusMegaCorp (TM)| unicode:: BogusMegaCorp U+2122
1310        .. with trademark sign
1311     .. |---| unicode:: U+02014 .. em dash
1312        :trim:
1314 results in:
1316     Copyright |copy| 2003, |BogusMegaCorp (TM)| |---|
1317     all rights reserved.
1319     .. |copy| unicode:: 0xA9 .. copyright sign
1320     .. |BogusMegaCorp (TM)| unicode:: BogusMegaCorp U+2122
1321        .. with trademark sign
1322     .. |---| unicode:: U+02014 .. em dash
1323        :trim:
1325 The following options are recognized:
1327 ``ltrim`` : flag
1328     Whitespace to the left of the substitution reference is removed.
1330 ``rtrim`` : flag
1331     Whitespace to the right of the substitution reference is removed.
1333 ``trim`` : flag
1334     Equivalent to ``ltrim`` plus ``rtrim``; whitespace on both sides
1335     of the substitution reference is removed.
1338 Date
1339 ====
1341 :Directive Type: "date"
1342 :Doctree Element: Text
1343 :Directive Arguments: One, optional (date format).
1344 :Directive Options: None.
1345 :Directive Content: None.
1347 The "date" directive generates the current local date and inserts it
1348 into the document as text.  This directive may be used in substitution
1349 definitions only.
1351 The optional directive content is interpreted as the desired date
1352 format, using the same codes as Python's time.strftime function.  The
1353 default format is "%Y-%m-%d" (ISO 8601 date), but time fields can also
1354 be used.  Examples::
1356     .. |date| date::
1357     .. |time| date:: %H:%M
1359     Today's date is |date|.
1361     This document was generated on |date| at |time|.
1364 ---------------
1365  Miscellaneous
1366 ---------------
1368 .. _include:
1370 Including an External Document Fragment
1371 =======================================
1373 :Directive Type: "include"
1374 :Doctree Elements: Depend on data being included
1375                    (literal_block_ with ``code`` or ``literal`` option).
1376 :Directive Arguments: One, required (path to the file to include).
1377 :Directive Options: Possible.
1378 :Directive Content: None.
1379 :Configuration Setting: file_insertion_enabled_
1381 .. WARNING::
1383    The "include" directive represents a potential security hole.  It
1384    can be disabled with the "file_insertion_enabled_" runtime setting.
1386    .. _file_insertion_enabled: ../../user/config.html#file-insertion-enabled
1388 The "include" directive reads a text file. The directive argument is
1389 the path to the file to be included, relative to the document
1390 containing the directive. Unless the options ``literal`` or ``code``
1391 are given, the file is parsed in the current document's context at the
1392 point of the directive. For example::
1394     This first example will be parsed at the document level, and can
1395     thus contain any construct, including section headers.
1397     .. include:: inclusion.txt
1399     Back in the main document.
1401         This second example will be parsed in a block quote context.
1402         Therefore it may only contain body elements.  It may not
1403         contain section headers.
1405         .. include:: inclusion.txt
1407 If an included document fragment contains section structure, the title
1408 adornments must match those of the master document.
1410 Standard data files intended for inclusion in reStructuredText
1411 documents are distributed with the Docutils source code, located in
1412 the "docutils" package in the ``docutils/parsers/rst/include``
1413 directory.  To access these files, use the special syntax for standard
1414 "include" data files, angle brackets around the file name::
1416     .. include:: <isonum.txt>
1418 The current set of standard "include" data files consists of sets of
1419 substitution definitions.  See `reStructuredText Standard Definition
1420 Files`__ for details.
1422 __ definitions.html
1424 The following options are recognized:
1426 ``start-line`` : integer
1427     Only the content starting from this line will be included.
1428     (As usual in Python, the first line has index 0 and negative values
1429     count from the end.)
1431 ``end-line`` : integer
1432     Only the content up to (but excluding) this line will be included.
1434 ``start-after`` : text to find in the external data file
1435     Only the content after the first occurrence of the specified text
1436     will be included.
1438 ``end-before`` : text to find in the external data file
1439     Only the content before the first occurrence of the specified text
1440     (but after any ``after`` text) will be included.
1442 ``literal`` : flag (empty)
1443     The entire included text is inserted into the document as a single
1444     literal block.
1446 ``code`` : formal language (optional)
1447     The argument and the content of the included file are passed to
1448     the code_ directive (useful for program listings).
1449     (New in Docutils 0.9)
1451 ``number-lines`` : [start line number]
1452     Precede every code line with a line number.
1453     The optional argument is the number of the first line (defaut 1).
1454     Works only with ``code`` or ``literal``.
1455     (New in Docutils 0.9)
1457 ``encoding`` : name of text encoding
1458     The text encoding of the external data file.  Defaults to the
1459     document's input_encoding_.
1461     .. _input_encoding: ../../user/config.html#input-encoding
1463 ``tab-width`` :  integer
1464     Number of spaces for hard tab expansion.
1465     A negative value prevents expansion of hard tabs. Defaults to the
1466     tab_width_ configuration setting.
1468     .. _tab_width: ../../user/config.html#tab-width
1471 With ``code`` or ``literal`` the common options `:class:`_ and
1472 `:name:`_ are recognized as well.
1474 Combining ``start/end-line`` and ``start-after/end-before`` is possible. The
1475 text markers will be searched in the specified lines (further limiting the
1476 included content).
1478 .. _raw-directive:
1480 Raw Data Pass-Through
1481 =====================
1483 :Directive Type: "raw"
1484 :Doctree Element: raw_
1485 :Directive Arguments: One or more, required (output format types).
1486 :Directive Options: Possible.
1487 :Directive Content: Stored verbatim, uninterpreted.  None (empty) if a
1488                     "file" or "url" option given.
1489 :Configuration Setting: raw_enabled_
1491 .. WARNING::
1493    The "raw" directive represents a potential security hole.  It can
1494    be disabled with the "raw_enabled_" or "file_insertion_enabled_"
1495    runtime settings.
1497    .. _raw_enabled: ../../user/config.html#raw-enabled
1499 .. Caution::
1501    The "raw" directive is a stop-gap measure allowing the author to
1502    bypass reStructuredText's markup.  It is a "power-user" feature
1503    that should not be overused or abused.  The use of "raw" ties
1504    documents to specific output formats and makes them less portable.
1506    If you often need to use the "raw" directive or a "raw"-derived
1507    interpreted text role, that is a sign either of overuse/abuse or
1508    that functionality may be missing from reStructuredText.  Please
1509    describe your situation in a message to the Docutils-users_ mailing
1510    list.
1512 .. _Docutils-users: ../../user/mailing-lists.html#docutils-users
1514 The "raw" directive indicates non-reStructuredText data that is to be
1515 passed untouched to the Writer.  The names of the output formats are
1516 given in the directive arguments.  The interpretation of the raw data
1517 is up to the Writer.  A Writer may ignore any raw output not matching
1518 its format.
1520 For example, the following input would be passed untouched by an HTML
1521 Writer::
1523     .. raw:: html
1525        <hr width=50 size=10>
1527 A LaTeX Writer could insert the following raw content into its
1528 output stream::
1530     .. raw:: latex
1532        \setlength{\parindent}{0pt}
1534 Raw data can also be read from an external file, specified in a
1535 directive option.  In this case, the content block must be empty.  For
1536 example::
1538     .. raw:: html
1539        :file: inclusion.html
1541 Inline equivalents of the "raw" directive can be defined via
1542 `custom interpreted text roles`_ derived from the `"raw" role`_.
1544 The following options are recognized:
1546 ``file`` : string (newlines removed)
1547     The local filesystem path of a raw data file to be included.
1549 ``url`` : string (whitespace removed)
1550     An Internet URL reference to a raw data file to be included.
1552 ``encoding`` : name of text encoding
1553     The text encoding of the external raw data (file or URL).
1554     Defaults to the document's encoding (if specified).
1556 .. _"raw" role: roles.html#raw
1559 .. _classes:
1561 Class
1562 =====
1564 :Directive Type: "class"
1565 :Doctree Element: pending_
1566 :Directive Arguments: One or more, required (class names / attribute
1567                       values).
1568 :Directive Options: None.
1569 :Directive Content: Optional.  If present, it is interpreted as body
1570                     elements.
1572 The "class" directive sets the `"classes"`_ attribute value on its content
1573 or on the first immediately following non-comment element [#]_.  For
1574 details of the "classes" attribute, see `its entry`__ in `The Docutils
1575 Document Tree`_.
1577 The directive argument consists of one or more space-separated class
1578 names. The names are transformed to conform to the regular expression
1579 ``[a-z](-?[a-z0-9]+)*`` by converting
1581 * alphabetic characters to lowercase,
1582 * accented characters to the base character,
1583 * non-alphanumeric characters to hyphens,
1584 * consecutive hyphens into one hyphen.
1586 For example "Rot-Gelb.Blau Grün:+2008" becomes "rot-gelb-blau grun-2008".
1587 (For the rationale_, see below.)
1589 __ ../doctree.html#classes
1591 Examples::
1593     .. class:: special
1595     This is a "special" paragraph.
1597     .. class:: exceptional remarkable
1599     An Exceptional Section
1600     ======================
1602     This is an ordinary paragraph.
1604     .. class:: multiple
1606        First paragraph.
1608        Second paragraph.
1610 The text above is parsed and transformed into this doctree fragment::
1612     <paragraph classes="special">
1613         This is a "special" paragraph.
1614     <section classes="exceptional remarkable">
1615         <title>
1616             An Exceptional Section
1617         <paragraph>
1618             This is an ordinary paragraph.
1619         <paragraph classes="multiple">
1620             First paragraph.
1621         <paragraph classes="multiple">
1622             Second paragraph.
1624 .. [#] To set a "classes" attribute value on a block quote, the
1625    "class" directive must be followed by an empty comment::
1627        .. class:: highlights
1628        ..
1630            Block quote text.
1632    Without the empty comment, the indented text would be interpreted as the
1633    "class" directive's content, and the classes would be applied to each
1634    element (paragraph, in this case) individually, instead of to the block
1635    quote as a whole.
1637 .. _rationale:
1639 .. topic:: Rationale for "classes" Attribute Value Conversion
1642     Docutils identifiers are converted to conform to the regular
1643     expression ``[a-z](-?[a-z0-9]+)*``.  For HTML + CSS compatibility,
1644     identifiers (the "classes" and "id" attributes) should have no
1645     underscores, colons, or periods.  Hyphens may be used.
1647     - The `HTML 4.01 spec`_ defines identifiers based on SGML tokens:
1649           ID and NAME tokens must begin with a letter ([A-Za-z]) and
1650           may be followed by any number of letters, digits ([0-9]),
1651           hyphens ("-"), underscores ("_"), colons (":"), and periods
1652           (".").
1654     - The `CSS1 spec`_ defines identifiers based on the "name" token
1655       ("flex" tokenizer notation below; "latin1" and "escape" 8-bit
1656       characters have been replaced with XML entities)::
1658           unicode     \\[0-9a-f]{1,4}
1659           latin1      [&iexcl;-&yuml;]
1660           escape      {unicode}|\\[ -~&iexcl;-&yuml;]
1661           nmchar      [-A-Za-z0-9]|{latin1}|{escape}
1662           name        {nmchar}+
1664     The CSS rule does not include underscores ("_"), colons (":"), or
1665     periods ("."), therefore "classes" and "id" attributes should not
1666     contain these characters.  Combined with HTML's requirements (the
1667     first character must be a letter; no "unicode", "latin1", or
1668     "escape" characters), this results in the regular expression
1669     ``[A-Za-z][-A-Za-z0-9]*``. Docutils adds a normalisation by
1670     downcasing and merge of consecutive hyphens.
1672     .. _HTML 4.01 spec: http://www.w3.org/TR/html401/
1673     .. _CSS1 spec: http://www.w3.org/TR/REC-CSS1
1676 .. _role:
1678 Custom Interpreted Text Roles
1679 =============================
1681 :Directive Type: "role"
1682 :Doctree Element: None; affects subsequent parsing.
1683 :Directive Arguments: Two; one required (new role name), one optional
1684                       (base role name, in parentheses).
1685 :Directive Options: Possible (depends on base role).
1686 :Directive Content: depends on base role.
1688 (New in Docutils 0.3.2)
1690 The "role" directive dynamically creates a custom interpreted text
1691 role and registers it with the parser.  This means that after
1692 declaring a role like this::
1694     .. role:: custom
1696 the document may use the new "custom" role::
1698     An example of using :custom:`interpreted text`
1700 This will be parsed into the following document tree fragment::
1702     <paragraph>
1703         An example of using
1704         <inline classes="custom">
1705             interpreted text
1707 The role must be declared in a document before it can be used.
1709 The new role may be based on an existing role, specified as a second
1710 argument in parentheses (whitespace optional)::
1712     .. role:: custom(emphasis)
1714     :custom:`text`
1716 The parsed result is as follows::
1718     <paragraph>
1719         <emphasis classes="custom">
1720             text
1722 A special case is the `"raw" role`_: derived roles enable
1723 inline `raw data pass-through`_, e.g.::
1725    .. role:: raw-role(raw)
1726       :format: html latex
1728    :raw-role:`raw text`
1730 If no base role is explicitly specified, a generic custom role is
1731 automatically used.  Subsequent interpreted text will produce an
1732 "inline" element with a `"classes"`_ attribute, as in the first example
1733 above.
1735 With most roles, the ":class:" option can be used to set a "classes"
1736 attribute that is different from the role name.  For example::
1738     .. role:: custom
1739        :class: special
1741     :custom:`interpreted text`
1743 This is the parsed result::
1745     <paragraph>
1746         <inline classes="special">
1747             interpreted text
1749 .. _role class:
1751 The following option is recognized by the "role" directive for most
1752 base roles:
1754 ``class`` : text
1755     Set the `"classes"`_ attribute value on the element produced
1756     (``inline``, or element associated with a base class) when the
1757     custom interpreted text role is used.  If no directive options are
1758     specified, a "class" option with the directive argument (role
1759     name) as the value is implied.  See the class_ directive above.
1761 Specific base roles may support other options and/or directive
1762 content.  See the `reStructuredText Interpreted Text Roles`_ document
1763 for details.
1765 .. _reStructuredText Interpreted Text Roles: roles.html
1768 .. _default-role:
1770 Setting the Default Interpreted Text Role
1771 =========================================
1773 :Directive Type: "default-role"
1774 :Doctree Element: None; affects subsequent parsing.
1775 :Directive Arguments: One, optional (new default role name).
1776 :Directive Options: None.
1777 :Directive Content: None.
1779 (New in Docutils 0.3.10)
1781 The "default-role" directive sets the default interpreted text role,
1782 the role that is used for interpreted text without an explicit role.
1783 For example, after setting the default role like this::
1785     .. default-role:: subscript
1787 any subsequent use of implicit-role interpreted text in the document
1788 will use the "subscript" role::
1790     An example of a `default` role.
1792 This will be parsed into the following document tree fragment::
1794     <paragraph>
1795         An example of a
1796         <subscript>
1797             default
1798          role.
1800 Custom roles may be used (see the "role_" directive above), but it
1801 must have been declared in a document before it can be set as the
1802 default role.  See the `reStructuredText Interpreted Text Roles`_
1803 document for details of built-in roles.
1805 The directive may be used without an argument to restore the initial
1806 default interpreted text role, which is application-dependent.  The
1807 initial default interpreted text role of the standard reStructuredText
1808 parser is "title-reference".
1811 Metadata Document Title
1812 =======================
1814 :Directive Type: "title"
1815 :Doctree Element: None.
1816 :Directive Arguments: 1, required (the title text).
1817 :Directive Options: None.
1818 :Directive Content: None.
1820 The "title" directive specifies the document title as metadata, which
1821 does not become part of the document body.  It overrides a
1822 document-supplied title.  For example, in HTML output the metadata
1823 document title appears in the title bar of the browser window.
1826 Restructuredtext-Test-Directive
1827 ===============================
1829 :Directive Type: "restructuredtext-test-directive"
1830 :Doctree Element: system_warning
1831 :Directive Arguments: None.
1832 :Directive Options: None.
1833 :Directive Content: Interpreted as a literal block.
1835 This directive is provided for test purposes only.  (Nobody is
1836 expected to type in a name *that* long!)  It is converted into a
1837 level-1 (info) system message showing the directive data, possibly
1838 followed by a literal block containing the rest of the directive
1839 block.
1841 --------------
1842 Common Options
1843 --------------
1845 Most of the directives that generate doctree elements support the following
1846 options:
1848 _`:class:` : text
1849     Set a `"classes"`_ attribute value on the doctree element generated by
1850     the directive. See also the class_ directive.
1852 _`:name:` : text
1853     Add `text` to the `"names"`_ attribute of the doctree element generated
1854     by the directive. This allows `hyperlink references`_ to the element
1855     using `text` as `reference name`_.
1857     Specifying the `name` option of a directive, e.g., ::
1859       .. image:: bild.png
1860          :name: my picture
1862     is a concise syntax alternative to preceding it with a `hyperlink
1863     target`_ ::
1865       .. _my picture:
1867       .. image:: bild.png
1869     New in Docutils 0.8.
1872 .. _reference name: restructuredtext.html#reference-names
1873 .. _hyperlink target: restructuredtext.html#hyperlink-targets
1874 .. _hyperlink references: restructuredtext.html#hyperlink-references
1875 .. _"classes": ../doctree.html#classes
1876 .. _"names": ../doctree.html#names
1877 .. _admonition: ../doctree.html#admonition
1878 .. _block_quote: ../doctree.html#block-quote
1879 .. _caption: ../doctree.html#caption
1880 .. _compound: ../doctree.html#compound
1881 .. _container: ../doctree.html#container
1882 .. _decoration: ../doctree.html#decoration
1883 .. _figure: ../doctree.html#figure
1884 .. _footnote: ../doctree.html#footnote
1885 .. _footnote_reference: ../doctree.html#footnote-reference
1886 .. _generated: ../doctree.html#generated
1887 .. _image: ../doctree.html#image
1888 .. _inline elements: ../doctree.html#inline-elements
1889 .. _literal_block: ../doctree.html#literal-block
1890 .. _legend: ../doctree.html#legend
1891 .. _line_block: ../doctree.html#line-block
1892 .. _math_block: ../doctree.html#math-block
1893 .. _pending: ../doctree.html#pending
1894 .. _raw: ../doctree.html#raw
1895 .. _rubric: ../doctree.html#rubric
1896 .. _sidebar: ../doctree.html#sidebar
1897 .. _table: ../doctree.html#table
1898 .. _title: ../doctree.html#title
1899 .. _topic: ../doctree.html#topic
1904    Local Variables:
1905    mode: indented-text
1906    indent-tabs-mode: nil
1907    sentence-end-double-space: t
1908    fill-column: 70
1909    End: