Syntax highlight requires a stylesheet.
[docutils.git] / docutils / docs / ref / rst / directives.txt
blob7d139b9a1ead0c0269d64d04f9f73292b9527f2a
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 block(s) with mathematical content
542 (display formulas, equations) into the document. The input format is
543 *LaTeX math syntax* (see, e.g. the `Short Math Guide`_) with support
544 for Unicode symbols, for example::
546   .. math::
548     α_t(i) = P(O_1, O_2, … O_t, q_t = S_i λ)
550 For inline math, use the `"math" role`_.
552 Support for math may be limited by the output format. If a writer does
553 not support math typesetting, the content is inserted verbatim.
554 For HTML, the output format can be set with the `math_output`_
555 configuration setting (or the corresponding ``--math-output`` command
556 line option).
558 .. _Short Math Guide: ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf
559 .. _"math" role: roles.html#math
560 .. _math_output: ../../user/config.html#math-output
562 Rubric
563 ======
565 :Directive Type: "rubric"
566 :Doctree Element: rubric_
567 :Directive Arguments: 1, required (rubric text).
568 :Directive Options: `:class:`_, `:name:`_
569 :Directive Content: None.
573      rubric n. 1. a title, heading, or the like, in a manuscript,
574      book, statute, etc., written or printed in red or otherwise
575      distinguished from the rest of the text. ...
577      -- Random House Webster's College Dictionary, 1991
579 The "rubric" directive inserts a "rubric" element into the document
580 tree.  A rubric is like an informal heading that doesn't correspond to
581 the document's structure.
584 Epigraph
585 ========
587 :Directive Type: "epigraph"
588 :Doctree Element: block_quote_
589 :Directive Arguments: None.
590 :Directive Options: None.
591 :Directive Content: Interpreted as the body of the block quote.
593 An epigraph is an apposite (suitable, apt, or pertinent) short
594 inscription, often a quotation or poem, at the beginning of a document
595 or section.
597 The "epigraph" directive produces an "epigraph"-class block quote.
598 For example, this input::
600      .. epigraph::
602         No matter where you go, there you are.
604         -- Buckaroo Banzai
606 becomes this document tree fragment::
608     <block_quote classes="epigraph">
609         <paragraph>
610             No matter where you go, there you are.
611         <attribution>
612             Buckaroo Banzai
615 Highlights
616 ==========
618 :Directive Type: "highlights"
619 :Doctree Element: block_quote_
620 :Directive Arguments: None.
621 :Directive Options: None.
622 :Directive Content: Interpreted as the body of the block quote.
624 Highlights summarize the main points of a document or section, often
625 consisting of a list.
627 The "highlights" directive produces a "highlights"-class block quote.
628 See Epigraph_ above for an analogous example.
631 Pull-Quote
632 ==========
634 :Directive Type: "pull-quote"
635 :Doctree Element: block_quote_
636 :Directive Arguments: None.
637 :Directive Options: None.
638 :Directive Content: Interpreted as the body of the block quote.
640 A pull-quote is a small selection of text "pulled out and quoted",
641 typically in a larger typeface.  Pull-quotes are used to attract
642 attention, especially in long articles.
644 The "pull-quote" directive produces a "pull-quote"-class block quote.
645 See Epigraph_ above for an analogous example.
648 Compound Paragraph
649 ==================
651 :Directive Type: "compound"
652 :Doctree Element: compound_
653 :Directive Arguments: None.
654 :Directive Options: `:class:`_, `:name:`_
655 :Directive Content: Interpreted as body elements.
657 (New in Docutils 0.3.6)
659 The "compound" directive is used to create a compound paragraph, which
660 is a single logical paragraph containing multiple physical body
661 elements such as simple paragraphs, literal blocks, tables, lists,
662 etc., instead of directly containing text and inline elements.  For
663 example::
665     .. compound::
667        The 'rm' command is very dangerous.  If you are logged
668        in as root and enter ::
670            cd /
671            rm -rf *
673        you will erase the entire contents of your file system.
675 In the example above, a literal block is "embedded" within a sentence
676 that begins in one physical paragraph and ends in another.
678 .. note::
680    The "compound" directive is *not* a generic block-level container
681    like HTML's ``<div>`` element.  Do not use it only to group a
682    sequence of elements, or you may get unexpected results.
684    If you need a generic block-level container, please use the
685    container_ directive, described below.
687 Compound paragraphs are typically rendered as multiple distinct text
688 blocks, with the possibility of variations to emphasize their logical
689 unity:
691 * If paragraphs are rendered with a first-line indent, only the first
692   physical paragraph of a compound paragraph should have that indent
693   -- second and further physical paragraphs should omit the indents;
694 * vertical spacing between physical elements may be reduced;
695 * and so on.
698 Container
699 =========
701 :Directive Type: "container"
702 :Doctree Element: container_
703 :Directive Arguments: One or more, optional (class names).
704 :Directive Options: `:name:`_
705 :Directive Content: Interpreted as body elements.
707 (New in Docutils 0.3.10)
709 The "container" directive surrounds its contents (arbitrary body
710 elements) with a generic block-level "container" element.  Combined
711 with the optional "classes_" attribute argument(s), this is an
712 extension mechanism for users & applications.  For example::
714     .. container:: custom
716        This paragraph might be rendered in a custom way.
718 Parsing the above results in the following pseudo-XML::
720     <container classes="custom">
721         <paragraph>
722             This paragraph might be rendered in a custom way.
724 The "container" directive is the equivalent of HTML's ``<div>``
725 element.  It may be used to group a sequence of elements for user- or
726 application-specific purposes.
730 --------
731  Tables
732 --------
734 Formal tables need more structure than the reStructuredText syntax
735 supplies.  Tables may be given titles with the table_ directive.
736 Sometimes reStructuredText tables are inconvenient to write, or table
737 data in a standard format is readily available.  The csv-table_
738 directive supports CSV data.
741 Table
742 =====
744 :Directive Type: "table"
745 :Doctree Element: table_
746 :Directive Arguments: 1, optional (table title).
747 :Directive Options: `:class:`_, `:name:`_
748 :Directive Content: A normal reStructuredText table.
750 (New in Docutils 0.3.1)
752 The "table" directive is used to create a titled table, to associate a
753 title with a table::
755     .. table:: Truth table for "not"
757        =====  =====
758          A    not A
759        =====  =====
760        False  True
761        True   False
762        =====  =====
765 .. _csv-table:
767 CSV Table
768 =========
770 :Directive Type: "csv-table"
771 :Doctree Element: table_
772 :Directive Arguments: 1, optional (table title).
773 :Directive Options: Possible (see below).
774 :Directive Content: A CSV (comma-separated values) table.
776 .. WARNING::
778    The "csv-table" directive's ":file:" and ":url:" options represent
779    a potential security holes.  They can be disabled with the
780    "file_insertion_enabled_" runtime setting.
782 (New in Docutils 0.3.4)
784 The "csv-table" directive is used to create a table from CSV
785 (comma-separated values) data.  CSV is a common data format generated
786 by spreadsheet applications and commercial databases.  The data may be
787 internal (an integral part of the document) or external (a separate
788 file).
790 Example::
792     .. csv-table:: Frozen Delights!
793        :header: "Treat", "Quantity", "Description"
794        :widths: 15, 10, 30
796        "Albatross", 2.99, "On a stick!"
797        "Crunchy Frog", 1.49, "If we took the bones out, it wouldn't be
798        crunchy, now would it?"
799        "Gannet Ripple", 1.99, "On a stick!"
801 Block markup and inline markup within cells is supported.  Line ends
802 are recognized within cells.
804 Working limitations:
806 * Whitespace delimiters are supported only for external CSV files.
808 * There is no support for checking that the number of columns in each
809   row is the same.  However, this directive supports CSV generators
810   that do not insert "empty" entries at the end of short rows, by
811   automatically adding empty entries.
813   .. Add "strict" option to verify input?
815 The following options are recognized:
817 ``widths`` : integer [, integer...]
818     A comma- or space-separated list of relative column widths.  The
819     default is equal-width columns (100%/#columns).
821 ``header-rows`` : integer
822     The number of rows of CSV data to use in the table header.
823     Defaults to 0.
825 ``stub-columns`` : integer
826     The number of table columns to use as stubs (row titles, on the
827     left).  Defaults to 0.
829 ``header`` : CSV data
830     Supplemental data for the table header, added independently of and
831     before any ``header-rows`` from the main CSV data.  Must use the
832     same CSV format as the main CSV data.
834 ``file`` : string (newlines removed)
835     The local filesystem path to a CSV data file.
837 ``url`` : string (whitespace removed)
838     An Internet URL reference to a CSV data file.
840 ``encoding`` : name of text encoding
841     The text encoding of the external CSV data (file or URL).
842     Defaults to the document's encoding (if specified).
844 ``delim`` : char | "tab" | "space"
845     A one-character string used to separate fields.  Defaults to ``,``
846     (comma).  May be specified as a Unicode code point; see the
847     unicode_ directive for syntax details.
849 ``quote`` : char
850     A one-character string used to quote elements containing the
851     delimiter or which start with the quote character.  Defaults to
852     ``"`` (quote).  May be specified as a Unicode code point; see the
853     unicode_ directive for syntax details.
855 ``keepspace`` : flag
856     Treat whitespace immediately following the delimiter as
857     significant.  The default is to ignore such whitespace.
859 ``escape`` : char
860     A one-character string used to escape the delimiter or quote
861     characters.  May be specified as a Unicode code point; see the
862     unicode_ directive for syntax details.  Used when the delimiter is
863     used in an unquoted field, or when quote characters are used
864     within a field.  The default is to double-up the character,
865     e.g. "He said, ""Hi!"""
867     .. Add another possible value, "double", to explicitly indicate
868        the default case?
870 and the common options `:class:`_ and `:name:`_.
873 List Table
874 ==========
876 :Directive Type: "list-table"
877 :Doctree Element: table_
878 :Directive Arguments: 1, optional (table title).
879 :Directive Options: Possible (see below).
880 :Directive Content: A uniform two-level bullet list.
882 (New in Docutils 0.3.8.  This is an initial implementation; `further
883 ideas`__ may be implemented in the future.)
885 __ ../../dev/rst/alternatives.html#list-driven-tables
887 The "list-table" directive is used to create a table from data in a
888 uniform two-level bullet list.  "Uniform" means that each sublist
889 (second-level list) must contain the same number of list items.
891 Example::
893     .. list-table:: Frozen Delights!
894        :widths: 15 10 30
895        :header-rows: 1
897        * - Treat
898          - Quantity
899          - Description
900        * - Albatross
901          - 2.99
902          - On a stick!
903        * - Crunchy Frog
904          - 1.49
905          - If we took the bones out, it wouldn't be
906            crunchy, now would it?
907        * - Gannet Ripple
908          - 1.99
909          - On a stick!
911 The following options are recognized:
913 ``widths`` : integer [integer...]
914     A comma- or space-separated list of relative column widths.  The
915     default is equal-width columns (100%/#columns).
917 ``header-rows`` : integer
918     The number of rows of list data to use in the table header.
919     Defaults to 0.
921 ``stub-columns`` : integer
922     The number of table columns to use as stubs (row titles, on the
923     left).  Defaults to 0.
925 and the common options `:class:`_ and `:name:`_.
928 ----------------
929  Document Parts
930 ----------------
932 .. _contents:
934 Table of Contents
935 =================
937 :Directive Type: "contents"
938 :Doctree Elements: pending_, topic_
939 :Directive Arguments: One, optional: title.
940 :Directive Options: Possible.
941 :Directive Content: None.
943 The "contents" directive generates a table of contents (TOC) in a
944 topic_.  Topics, and therefore tables of contents, may occur anywhere
945 a section or transition may occur.  Body elements and topics may not
946 contain tables of contents.
948 Here's the directive in its simplest form::
950     .. contents::
952 Language-dependent boilerplate text will be used for the title.  The
953 English default title text is "Contents".
955 An explicit title may be specified::
957     .. contents:: Table of Contents
959 The title may span lines, although it is not recommended::
961     .. contents:: Here's a very long Table of
962        Contents title
964 Options may be specified for the directive, using a field list::
966     .. contents:: Table of Contents
967        :depth: 2
969 If the default title is to be used, the options field list may begin
970 on the same line as the directive marker::
972     .. contents:: :depth: 2
974 The following options are recognized:
976 ``depth`` : integer
977     The number of section levels that are collected in the table of
978     contents.  The default is unlimited depth.
980 ``local`` : flag (empty)
981     Generate a local table of contents.  Entries will only include
982     subsections of the section in which the directive is given.  If no
983     explicit title is given, the table of contents will not be titled.
985 ``backlinks`` : "entry" or "top" or "none"
986     Generate links from section headers back to the table of contents
987     entries, the table of contents itself, or generate no backlinks.
989 ``class`` : text
990     Set a `"classes"`_ attribute value on the topic element.  See the
991     class_ directive below.
994 .. _sectnum:
995 .. _section-autonumbering:
997 Automatic Section Numbering
998 ===========================
1000 :Directive Type: "sectnum" or "section-autonumbering" (synonyms)
1001 :Doctree Elements: pending_, generated_
1002 :Directive Arguments: None.
1003 :Directive Options: Possible.
1004 :Directive Content: None.
1005 :Configuration Setting: sectnum_xform_
1007 The "sectnum" (or "section-autonumbering") directive automatically numbers
1008 sections and subsections in a document (if not disabled by the
1009 ``--no-section-numbering`` command line option or the `sectnum_xform`_
1010 configuration setting).
1012 Section numbers are of the "multiple enumeration" form, where each
1013 level has a number, separated by periods.  For example, the title of section
1014 1, subsection 2, subsubsection 3 would have "1.2.3" prefixed.
1016 The "sectnum" directive does its work in two passes: the initial parse
1017 and a transform.  During the initial parse, a "pending" element is
1018 generated which acts as a placeholder, storing any options internally.
1019 At a later stage in the processing, the "pending" element triggers a
1020 transform, which adds section numbers to titles.  Section numbers are
1021 enclosed in a "generated" element, and titles have their "auto"
1022 attribute set to "1".
1024 The following options are recognized:
1026 ``depth`` : integer
1027     The number of section levels that are numbered by this directive.
1028     The default is unlimited depth.
1030 ``prefix`` : string
1031     An arbitrary string that is prefixed to the automatically
1032     generated section numbers.  It may be something like "3.2.", which
1033     will produce "3.2.1", "3.2.2", "3.2.2.1", and so on.  Note that
1034     any separating punctuation (in the example, a period, ".") must be
1035     explicitly provided.  The default is no prefix.
1037 ``suffix`` : string
1038     An arbitrary string that is appended to the automatically
1039     generated section numbers.  The default is no suffix.
1041 ``start`` : integer
1042     The value that will be used for the first section number.
1043     Combined with ``prefix``, this may be used to force the right
1044     numbering for a document split over several source files.  The
1045     default is 1.
1047 .. _sectnum_xform: ../../user/config.html#sectnum-xform
1050 .. _header:
1051 .. _footer:
1053 Document Header & Footer
1054 ========================
1056 :Directive Types: "header" and "footer"
1057 :Doctree Elements: decoration_, header, footer
1058 :Directive Arguments: None.
1059 :Directive Options: None.
1060 :Directive Content: Interpreted as body elements.
1062 (New in Docutils 0.3.8)
1064 The "header" and "footer" directives create document decorations,
1065 useful for page navigation, notes, time/datestamp, etc.  For example::
1067     .. header:: This space for rent.
1069 This will add a paragraph to the document header, which will appear at
1070 the top of the generated web page or at the top of every printed page.
1072 These directives may be used multiple times, cumulatively.  There is
1073 currently support for only one header and footer.
1075 .. note::
1077    While it is possible to use the "header" and "footer" directives to
1078    create navigational elements for web pages, you should be aware
1079    that Docutils is meant to be used for *document* processing, and
1080    that a navigation bar is not typically part of a document.
1082    Thus, you may soon find Docutils' abilities to be insufficient for
1083    these purposes.  At that time, you should consider using a
1084    documentation generator like Sphinx_ rather than the "header" and
1085    "footer" directives.
1087    .. _Sphinx: http://sphinx-doc.org/
1089 In addition to the use of these directives to populate header and
1090 footer content, content may also be added automatically by the
1091 processing system.  For example, if certain runtime settings are
1092 enabled, the document footer is populated with processing information
1093 such as a datestamp, a link to `the Docutils website`_, etc.
1095 .. _the Docutils website: http://docutils.sourceforge.net
1098 ------------
1099  References
1100 ------------
1102 .. _target-notes:
1104 Target Footnotes
1105 ================
1107 :Directive Type: "target-notes"
1108 :Doctree Elements: pending_, footnote_, footnote_reference_
1109 :Directive Arguments: None.
1110 :Directive Options: `:class:`_, `:name:`_
1111 :Directive Options: Possible.
1112 :Directive Content: None.
1114 The "target-notes" directive creates a footnote for each external
1115 target in the text, and corresponding footnote references after each
1116 reference.  For every explicit target (of the form, ``.. _target name:
1117 URL``) in the text, a footnote will be generated containing the
1118 visible URL as content.
1121 Footnotes
1122 =========
1124 **NOT IMPLEMENTED YET**
1126 :Directive Type: "footnotes"
1127 :Doctree Elements: pending_, topic_
1128 :Directive Arguments: None?
1129 :Directive Options: Possible?
1130 :Directive Content: None.
1135 Citations
1136 =========
1138 **NOT IMPLEMENTED YET**
1140 :Directive Type: "citations"
1141 :Doctree Elements: pending_, topic_
1142 :Directive Arguments: None?
1143 :Directive Options: Possible?
1144 :Directive Content: None.
1149 ---------------
1150  HTML-Specific
1151 ---------------
1153 Meta
1154 ====
1156 :Directive Type: "meta"
1157 :Doctree Element: meta (non-standard)
1158 :Directive Arguments: None.
1159 :Directive Options: None.
1160 :Directive Content: Must contain a flat field list.
1162 The "meta" directive is used to specify HTML metadata stored in HTML
1163 META tags.  "Metadata" is data about data, in this case data about web
1164 pages.  Metadata is used to describe and classify web pages in the
1165 World Wide Web, in a form that is easy for search engines to extract
1166 and collate.
1168 Within the directive block, a flat field list provides the syntax for
1169 metadata.  The field name becomes the contents of the "name" attribute
1170 of the META tag, and the field body (interpreted as a single string
1171 without inline markup) becomes the contents of the "content"
1172 attribute.  For example::
1174     .. meta::
1175        :description: The reStructuredText plaintext markup language
1176        :keywords: plaintext, markup language
1178 This would be converted to the following HTML::
1180     <meta name="description"
1181         content="The reStructuredText plaintext markup language">
1182     <meta name="keywords" content="plaintext, markup language">
1184 Support for other META attributes ("http-equiv", "scheme", "lang",
1185 "dir") are provided through field arguments, which must be of the form
1186 "attr=value"::
1188     .. meta::
1189        :description lang=en: An amusing story
1190        :description lang=fr: Une histoire amusante
1192 And their HTML equivalents::
1194     <meta name="description" lang="en" content="An amusing story">
1195     <meta name="description" lang="fr" content="Une histoire amusante">
1197 Some META tags use an "http-equiv" attribute instead of the "name"
1198 attribute.  To specify "http-equiv" META tags, simply omit the name::
1200     .. meta::
1201        :http-equiv=Content-Type: text/html; charset=ISO-8859-1
1203 HTML equivalent::
1205     <meta http-equiv="Content-Type"
1206          content="text/html; charset=ISO-8859-1">
1209 Imagemap
1210 ========
1212 **NOT IMPLEMENTED YET**
1214 Non-standard element: imagemap.
1217 -----------------------------------------
1218  Directives for Substitution Definitions
1219 -----------------------------------------
1221 The directives in this section may only be used in substitution
1222 definitions.  They may not be used directly, in standalone context.
1223 The `image`_ directive may be used both in substitution definitions
1224 and in the standalone context.
1227 .. _replace:
1229 Replacement Text
1230 ================
1232 :Directive Type: "replace"
1233 :Doctree Element: Text & `inline elements`_
1234 :Directive Arguments: None.
1235 :Directive Options: None.
1236 :Directive Content: A single paragraph; may contain inline markup.
1238 The "replace" directive is used to indicate replacement text for a
1239 substitution reference.  It may be used within substitution
1240 definitions only.  For example, this directive can be used to expand
1241 abbreviations::
1243     .. |reST| replace:: reStructuredText
1245     Yes, |reST| is a long word, so I can't blame anyone for wanting to
1246     abbreviate it.
1248 As reStructuredText doesn't support nested inline markup, the only way
1249 to create a reference with styled text is to use substitutions with
1250 the "replace" directive::
1252     I recommend you try |Python|_.
1254     .. |Python| replace:: Python, *the* best language around
1255     .. _Python: http://www.python.org/
1258 .. _unicode:
1260 Unicode Character Codes
1261 =======================
1263 :Directive Type: "unicode"
1264 :Doctree Element: Text
1265 :Directive Arguments: One or more, required (Unicode character codes,
1266                       optional text, and comments).
1267 :Directive Options: Possible.
1268 :Directive Content: None.
1270 The "unicode" directive converts Unicode character codes (numerical
1271 values) to characters, and may be used in substitution definitions
1272 only.
1274 The arguments, separated by spaces, can be:
1276 * **character codes** as
1278   - decimal numbers or
1280   - hexadecimal numbers, prefixed by ``0x``, ``x``, ``\x``, ``U+``,
1281     ``u``, or ``\u`` or as XML-style hexadecimal character entities,
1282     e.g. ``&#x1a2b;``
1284 * **text**, which is used as-is.
1286 Text following " .. " is a comment and is ignored.  The spaces between
1287 the arguments are ignored and thus do not appear in the output.
1288 Hexadecimal codes are case-insensitive.
1290 For example, the following text::
1292     Copyright |copy| 2003, |BogusMegaCorp (TM)| |---|
1293     all rights reserved.
1295     .. |copy| unicode:: 0xA9 .. copyright sign
1296     .. |BogusMegaCorp (TM)| unicode:: BogusMegaCorp U+2122
1297        .. with trademark sign
1298     .. |---| unicode:: U+02014 .. em dash
1299        :trim:
1301 results in:
1303     Copyright |copy| 2003, |BogusMegaCorp (TM)| |---|
1304     all rights reserved.
1306     .. |copy| unicode:: 0xA9 .. copyright sign
1307     .. |BogusMegaCorp (TM)| unicode:: BogusMegaCorp U+2122
1308        .. with trademark sign
1309     .. |---| unicode:: U+02014 .. em dash
1310        :trim:
1312 The following options are recognized:
1314 ``ltrim`` : flag
1315     Whitespace to the left of the substitution reference is removed.
1317 ``rtrim`` : flag
1318     Whitespace to the right of the substitution reference is removed.
1320 ``trim`` : flag
1321     Equivalent to ``ltrim`` plus ``rtrim``; whitespace on both sides
1322     of the substitution reference is removed.
1325 Date
1326 ====
1328 :Directive Type: "date"
1329 :Doctree Element: Text
1330 :Directive Arguments: One, optional (date format).
1331 :Directive Options: None.
1332 :Directive Content: None.
1334 The "date" directive generates the current local date and inserts it
1335 into the document as text.  This directive may be used in substitution
1336 definitions only.
1338 The optional directive content is interpreted as the desired date
1339 format, using the same codes as Python's time.strftime function.  The
1340 default format is "%Y-%m-%d" (ISO 8601 date), but time fields can also
1341 be used.  Examples::
1343     .. |date| date::
1344     .. |time| date:: %H:%M
1346     Today's date is |date|.
1348     This document was generated on |date| at |time|.
1351 ---------------
1352  Miscellaneous
1353 ---------------
1355 .. _include:
1357 Including an External Document Fragment
1358 =======================================
1360 :Directive Type: "include"
1361 :Doctree Elements: Depend on data being included
1362                    (literal_block_ with ``code`` or ``literal`` option).
1363 :Directive Arguments: One, required (path to the file to include).
1364 :Directive Options: Possible.
1365 :Directive Content: None.
1366 :Configuration Setting: file_insertion_enabled_
1368 .. WARNING::
1370    The "include" directive represents a potential security hole.  It
1371    can be disabled with the "file_insertion_enabled_" runtime setting.
1373    .. _file_insertion_enabled: ../../user/config.html#file-insertion-enabled
1375 The "include" directive reads a text file. The directive argument is
1376 the path to the file to be included, relative to the document
1377 containing the directive. Unless the options ``literal`` or ``code``
1378 are given, the file is parsed in the current document's context at the
1379 point of the directive. For example::
1381     This first example will be parsed at the document level, and can
1382     thus contain any construct, including section headers.
1384     .. include:: inclusion.txt
1386     Back in the main document.
1388         This second example will be parsed in a block quote context.
1389         Therefore it may only contain body elements.  It may not
1390         contain section headers.
1392         .. include:: inclusion.txt
1394 If an included document fragment contains section structure, the title
1395 adornments must match those of the master document.
1397 Standard data files intended for inclusion in reStructuredText
1398 documents are distributed with the Docutils source code, located in
1399 the "docutils" package in the ``docutils/parsers/rst/include``
1400 directory.  To access these files, use the special syntax for standard
1401 "include" data files, angle brackets around the file name::
1403     .. include:: <isonum.txt>
1405 The current set of standard "include" data files consists of sets of
1406 substitution definitions.  See `reStructuredText Standard Definition
1407 Files`__ for details.
1409 __ definitions.html
1411 The following options are recognized:
1413 ``start-line`` : integer
1414     Only the content starting from this line will be included.
1415     (As usual in Python, the first line has index 0 and negative values
1416     count from the end.)
1418 ``end-line`` : integer
1419     Only the content up to (but excluding) this line will be included.
1421 ``start-after`` : text to find in the external data file
1422     Only the content after the first occurrence of the specified text
1423     will be included.
1425 ``end-before`` : text to find in the external data file
1426     Only the content before the first occurrence of the specified text
1427     (but after any ``after`` text) will be included.
1429 ``literal`` : flag (empty)
1430     The entire included text is inserted into the document as a single
1431     literal block.
1433 ``code`` : formal language (optional)
1434     The argument and the content of the included file are passed to
1435     the code_ directive (useful for program listings).
1436     (New in Docutils 0.9)
1438 ``number-lines`` : [start line number]
1439     Precede every code line with a line number.
1440     The optional argument is the number of the first line (defaut 1).
1441     Works only with ``code`` or ``literal``.
1442     (New in Docutils 0.9)
1444 ``encoding`` : name of text encoding
1445     The text encoding of the external data file.  Defaults to the
1446     document's input_encoding_.
1448     .. _input_encoding: ../../user/config.html#input-encoding
1450 ``tab-width`` :  integer
1451     Number of spaces for hard tab expansion.
1452     A negative value prevents expansion of hard tabs. Defaults to the
1453     tab_width_ configuration setting.
1455     .. _tab_width: ../../user/config.html#tab-width
1458 With ``code`` or ``literal`` the common options `:class:`_ and
1459 `:name:`_ are recognized as well.
1461 Combining ``start/end-line`` and ``start-after/end-before`` is possible. The
1462 text markers will be searched in the specified lines (further limiting the
1463 included content).
1465 .. _raw-directive:
1467 Raw Data Pass-Through
1468 =====================
1470 :Directive Type: "raw"
1471 :Doctree Element: raw_
1472 :Directive Arguments: One or more, required (output format types).
1473 :Directive Options: Possible.
1474 :Directive Content: Stored verbatim, uninterpreted.  None (empty) if a
1475                     "file" or "url" option given.
1476 :Configuration Setting: raw_enabled_
1478 .. WARNING::
1480    The "raw" directive represents a potential security hole.  It can
1481    be disabled with the "raw_enabled_" or "file_insertion_enabled_"
1482    runtime settings.
1484    .. _raw_enabled: ../../user/config.html#raw-enabled
1486 .. Caution::
1488    The "raw" directive is a stop-gap measure allowing the author to
1489    bypass reStructuredText's markup.  It is a "power-user" feature
1490    that should not be overused or abused.  The use of "raw" ties
1491    documents to specific output formats and makes them less portable.
1493    If you often need to use the "raw" directive or a "raw"-derived
1494    interpreted text role, that is a sign either of overuse/abuse or
1495    that functionality may be missing from reStructuredText.  Please
1496    describe your situation in a message to the Docutils-users_ mailing
1497    list.
1499 .. _Docutils-users: ../../user/mailing-lists.html#docutils-users
1501 The "raw" directive indicates non-reStructuredText data that is to be
1502 passed untouched to the Writer.  The names of the output formats are
1503 given in the directive arguments.  The interpretation of the raw data
1504 is up to the Writer.  A Writer may ignore any raw output not matching
1505 its format.
1507 For example, the following input would be passed untouched by an HTML
1508 Writer::
1510     .. raw:: html
1512        <hr width=50 size=10>
1514 A LaTeX Writer could insert the following raw content into its
1515 output stream::
1517     .. raw:: latex
1519        \setlength{\parindent}{0pt}
1521 Raw data can also be read from an external file, specified in a
1522 directive option.  In this case, the content block must be empty.  For
1523 example::
1525     .. raw:: html
1526        :file: inclusion.html
1528 Inline equivalents of the "raw" directive can be defined via
1529 `custom interpreted text roles`_ derived from the `"raw" role`_.
1531 The following options are recognized:
1533 ``file`` : string (newlines removed)
1534     The local filesystem path of a raw data file to be included.
1536 ``url`` : string (whitespace removed)
1537     An Internet URL reference to a raw data file to be included.
1539 ``encoding`` : name of text encoding
1540     The text encoding of the external raw data (file or URL).
1541     Defaults to the document's encoding (if specified).
1543 .. _"raw" role: roles.html#raw
1546 .. _classes:
1548 Class
1549 =====
1551 :Directive Type: "class"
1552 :Doctree Element: pending_
1553 :Directive Arguments: One or more, required (class names / attribute
1554                       values).
1555 :Directive Options: None.
1556 :Directive Content: Optional.  If present, it is interpreted as body
1557                     elements.
1559 The "class" directive sets the `"classes"`_ attribute value on its content
1560 or on the first immediately following non-comment element [#]_.  For
1561 details of the "classes" attribute, see `its entry`__ in `The Docutils
1562 Document Tree`_.
1564 The directive argument consists of one or more space-separated class
1565 names. The names are transformed to conform to the regular expression
1566 ``[a-z](-?[a-z0-9]+)*`` by converting
1568 * alphabetic characters to lowercase,
1569 * accented characters to the base character,
1570 * non-alphanumeric characters to hyphens,
1571 * consecutive hyphens into one hyphen.
1573 For example "Rot-Gelb.Blau Grün:+2008" becomes "rot-gelb-blau grun-2008".
1574 (For the rationale_, see below.)
1576 __ ../doctree.html#classes
1578 Examples::
1580     .. class:: special
1582     This is a "special" paragraph.
1584     .. class:: exceptional remarkable
1586     An Exceptional Section
1587     ======================
1589     This is an ordinary paragraph.
1591     .. class:: multiple
1593        First paragraph.
1595        Second paragraph.
1597 The text above is parsed and transformed into this doctree fragment::
1599     <paragraph classes="special">
1600         This is a "special" paragraph.
1601     <section classes="exceptional remarkable">
1602         <title>
1603             An Exceptional Section
1604         <paragraph>
1605             This is an ordinary paragraph.
1606         <paragraph classes="multiple">
1607             First paragraph.
1608         <paragraph classes="multiple">
1609             Second paragraph.
1611 .. [#] To set a "classes" attribute value on a block quote, the
1612    "class" directive must be followed by an empty comment::
1614        .. class:: highlights
1615        ..
1617            Block quote text.
1619    Without the empty comment, the indented text would be interpreted as the
1620    "class" directive's content, and the classes would be applied to each
1621    element (paragraph, in this case) individually, instead of to the block
1622    quote as a whole.
1624 .. _rationale:
1626 .. topic:: Rationale for "classes" Attribute Value Conversion
1629     Docutils identifiers are converted to conform to the regular
1630     expression ``[a-z](-?[a-z0-9]+)*``.  For HTML + CSS compatibility,
1631     identifiers (the "classes" and "id" attributes) should have no
1632     underscores, colons, or periods.  Hyphens may be used.
1634     - The `HTML 4.01 spec`_ defines identifiers based on SGML tokens:
1636           ID and NAME tokens must begin with a letter ([A-Za-z]) and
1637           may be followed by any number of letters, digits ([0-9]),
1638           hyphens ("-"), underscores ("_"), colons (":"), and periods
1639           (".").
1641     - The `CSS1 spec`_ defines identifiers based on the "name" token
1642       ("flex" tokenizer notation below; "latin1" and "escape" 8-bit
1643       characters have been replaced with XML entities)::
1645           unicode     \\[0-9a-f]{1,4}
1646           latin1      [&iexcl;-&yuml;]
1647           escape      {unicode}|\\[ -~&iexcl;-&yuml;]
1648           nmchar      [-A-Za-z0-9]|{latin1}|{escape}
1649           name        {nmchar}+
1651     The CSS rule does not include underscores ("_"), colons (":"), or
1652     periods ("."), therefore "classes" and "id" attributes should not
1653     contain these characters.  Combined with HTML's requirements (the
1654     first character must be a letter; no "unicode", "latin1", or
1655     "escape" characters), this results in the regular expression
1656     ``[A-Za-z][-A-Za-z0-9]*``. Docutils adds a normalisation by
1657     downcasing and merge of consecutive hyphens.
1659     .. _HTML 4.01 spec: http://www.w3.org/TR/html401/
1660     .. _CSS1 spec: http://www.w3.org/TR/REC-CSS1
1663 .. _role:
1665 Custom Interpreted Text Roles
1666 =============================
1668 :Directive Type: "role"
1669 :Doctree Element: None; affects subsequent parsing.
1670 :Directive Arguments: Two; one required (new role name), one optional
1671                       (base role name, in parentheses).
1672 :Directive Options: Possible (depends on base role).
1673 :Directive Content: depends on base role.
1675 (New in Docutils 0.3.2)
1677 The "role" directive dynamically creates a custom interpreted text
1678 role and registers it with the parser.  This means that after
1679 declaring a role like this::
1681     .. role:: custom
1683 the document may use the new "custom" role::
1685     An example of using :custom:`interpreted text`
1687 This will be parsed into the following document tree fragment::
1689     <paragraph>
1690         An example of using
1691         <inline classes="custom">
1692             interpreted text
1694 The role must be declared in a document before it can be used.
1696 The new role may be based on an existing role, specified as a second
1697 argument in parentheses (whitespace optional)::
1699     .. role:: custom(emphasis)
1701     :custom:`text`
1703 The parsed result is as follows::
1705     <paragraph>
1706         <emphasis classes="custom">
1707             text
1709 A special case is the `"raw" role`_: derived roles enable
1710 inline `raw data pass-through`_, e.g.::
1712    .. role:: raw-role(raw)
1713       :format: html latex
1715    :raw-role:`raw text`
1717 If no base role is explicitly specified, a generic custom role is
1718 automatically used.  Subsequent interpreted text will produce an
1719 "inline" element with a `"classes"`_ attribute, as in the first example
1720 above.
1722 With most roles, the ":class:" option can be used to set a "classes"
1723 attribute that is different from the role name.  For example::
1725     .. role:: custom
1726        :class: special
1728     :custom:`interpreted text`
1730 This is the parsed result::
1732     <paragraph>
1733         <inline classes="special">
1734             interpreted text
1736 .. _role class:
1738 The following option is recognized by the "role" directive for most
1739 base roles:
1741 ``class`` : text
1742     Set the `"classes"`_ attribute value on the element produced
1743     (``inline``, or element associated with a base class) when the
1744     custom interpreted text role is used.  If no directive options are
1745     specified, a "class" option with the directive argument (role
1746     name) as the value is implied.  See the class_ directive above.
1748 Specific base roles may support other options and/or directive
1749 content.  See the `reStructuredText Interpreted Text Roles`_ document
1750 for details.
1752 .. _reStructuredText Interpreted Text Roles: roles.html
1755 .. _default-role:
1757 Setting the Default Interpreted Text Role
1758 =========================================
1760 :Directive Type: "default-role"
1761 :Doctree Element: None; affects subsequent parsing.
1762 :Directive Arguments: One, optional (new default role name).
1763 :Directive Options: None.
1764 :Directive Content: None.
1766 (New in Docutils 0.3.10)
1768 The "default-role" directive sets the default interpreted text role,
1769 the role that is used for interpreted text without an explicit role.
1770 For example, after setting the default role like this::
1772     .. default-role:: subscript
1774 any subsequent use of implicit-role interpreted text in the document
1775 will use the "subscript" role::
1777     An example of a `default` role.
1779 This will be parsed into the following document tree fragment::
1781     <paragraph>
1782         An example of a
1783         <subscript>
1784             default
1785          role.
1787 Custom roles may be used (see the "role_" directive above), but it
1788 must have been declared in a document before it can be set as the
1789 default role.  See the `reStructuredText Interpreted Text Roles`_
1790 document for details of built-in roles.
1792 The directive may be used without an argument to restore the initial
1793 default interpreted text role, which is application-dependent.  The
1794 initial default interpreted text role of the standard reStructuredText
1795 parser is "title-reference".
1798 Metadata Document Title
1799 =======================
1801 :Directive Type: "title"
1802 :Doctree Element: None.
1803 :Directive Arguments: 1, required (the title text).
1804 :Directive Options: None.
1805 :Directive Content: None.
1807 The "title" directive specifies the document title as metadata, which
1808 does not become part of the document body.  It overrides a
1809 document-supplied title.  For example, in HTML output the metadata
1810 document title appears in the title bar of the browser window.
1813 Restructuredtext-Test-Directive
1814 ===============================
1816 :Directive Type: "restructuredtext-test-directive"
1817 :Doctree Element: system_warning
1818 :Directive Arguments: None.
1819 :Directive Options: None.
1820 :Directive Content: Interpreted as a literal block.
1822 This directive is provided for test purposes only.  (Nobody is
1823 expected to type in a name *that* long!)  It is converted into a
1824 level-1 (info) system message showing the directive data, possibly
1825 followed by a literal block containing the rest of the directive
1826 block.
1828 --------------
1829 Common Options
1830 --------------
1832 Most of the directives that generate doctree elements support the following
1833 options:
1835 _`:class:` : text
1836     Set a `"classes"`_ attribute value on the doctree element generated by
1837     the directive. See also the class_ directive.
1839 _`:name:` : text
1840     Add `text` to the `"names"`_ attribute of the doctree element generated
1841     by the directive. This allows `hyperlink references`_ to the element
1842     using `text` as `reference name`_.
1844     Specifying the `name` option of a directive, e.g., ::
1846       .. image:: bild.png
1847          :name: my picture
1849     is a concise syntax alternative to preceding it with a `hyperlink
1850     target`_ ::
1852       .. _my picture:
1854       .. image:: bild.png
1856     New in Docutils 0.8.
1859 .. _reference name: restructuredtext.html#reference-names
1860 .. _hyperlink target: restructuredtext.html#hyperlink-targets
1861 .. _hyperlink references: restructuredtext.html#hyperlink-references
1862 .. _"classes": ../doctree.html#classes
1863 .. _"names": ../doctree.html#names
1864 .. _admonition: ../doctree.html#admonition
1865 .. _block_quote: ../doctree.html#block-quote
1866 .. _caption: ../doctree.html#caption
1867 .. _compound: ../doctree.html#compound
1868 .. _container: ../doctree.html#container
1869 .. _decoration: ../doctree.html#decoration
1870 .. _figure: ../doctree.html#figure
1871 .. _footnote: ../doctree.html#footnote
1872 .. _footnote_reference: ../doctree.html#footnote-reference
1873 .. _generated: ../doctree.html#generated
1874 .. _image: ../doctree.html#image
1875 .. _inline elements: ../doctree.html#inline-elements
1876 .. _literal_block: ../doctree.html#literal-block
1877 .. _legend: ../doctree.html#legend
1878 .. _line_block: ../doctree.html#line-block
1879 .. _math_block: ../doctree.html#math-block
1880 .. _pending: ../doctree.html#pending
1881 .. _raw: ../doctree.html#raw
1882 .. _rubric: ../doctree.html#rubric
1883 .. _sidebar: ../doctree.html#sidebar
1884 .. _table: ../doctree.html#table
1885 .. _title: ../doctree.html#title
1886 .. _topic: ../doctree.html#topic
1891    Local Variables:
1892    mode: indented-text
1893    indent-tabs-mode: nil
1894    sentence-end-double-space: t
1895    fill-column: 70
1896    End: