1 ============================
2 The Docutils Document Tree
3 ============================
5 A Guide to the Docutils DTD
6 ***************************
9 :Contact: docutils-develop@lists.sourceforge.net
12 :Copyright: This document has been placed in the public domain.
15 .. contents:: :depth: 1
18 This document describes the XML data structure of Docutils_ documents:
19 the relationships and semantics of elements and attributes. The
20 Docutils document structure is formally defined by the `Docutils
21 Generic DTD`_ XML document type definition, docutils.dtd_, which is
22 the definitive source for details of element structural relationships.
24 This document does not discuss implementation details. Those can be
25 found in internal documentation (docstrings) for the
26 ``docutils.nodes`` module, where the document tree data structure is
27 implemented in a class library.
29 The reader is assumed to have some familiarity with XML or SGML, and
30 an understanding of the data structure meaning of "tree". For a list
31 of introductory articles, see `Introducing the Extensible Markup
34 The reStructuredText_ markup is used for illustrative examples
35 throughout this document. For a gentle introduction, see `A
36 ReStructuredText Primer`_. For complete technical details, see the
37 `reStructuredText Markup Specification`_.
39 .. _Docutils: http://docutils.sourceforge.net/
40 .. _Docutils Generic DTD:
42 .. _docutils.dtd: docutils.dtd
43 .. _Introducing the Extensible Markup Language (XML):
44 http://xml.coverpages.org/xmlIntro.html
45 .. _reStructuredText: http://docutils.sourceforge.net/rst.html
46 .. _A ReStructuredText Primer: ../user/rst/quickstart.html
47 .. _reStructuredText Markup Specification: rst/restructuredtext.html
56 Below is a simplified diagram of the hierarchy of elements in the
57 Docutils document tree structure. An element may contain any other
58 elements immediately below it in the diagram. Notes are written in
59 square brackets. Element types in parentheses indicate recursive or
60 one-to-many relationships; sections may contain (sub)sections, tables
61 contain further body elements, etc. ::
63 +--------------------------------------------------------------------+
64 | document [may begin with a title, subtitle, decoration, docinfo] |
65 | +--------------------------------------+
66 | | sections [each begins with a title] |
67 +-----------------------------+-------------------------+------------+
68 | [body elements:] | (sections) |
69 | | - literal | - lists | | - hyperlink +------------+
70 | | blocks | - tables | | targets |
71 | para- | - doctest | - block | foot- | - sub. defs |
72 | graphs | blocks | quotes | notes | - comments |
73 +---------+-----------+----------+-------+--------------+
74 | [text]+ | [text] | (body elements) | [text] |
75 | (inline +-----------+------------------+--------------+
79 The Docutils document model uses a simple, recursive model for section
80 structure. A document_ node may contain body elements and section_
81 elements. Sections in turn may contain body elements and sections.
82 The level (depth) of a section element is determined from its physical
83 nesting level; unlike other document models (``<h1>`` in HTML_,
84 ``<sect1>`` in DocBook_, ``<div1>`` in XMLSpec_) the level is not
85 incorporated into the element name.
87 The Docutils document model uses strict element content models. Every
88 element has a unique structure and semantics, but elements may be
89 classified into general categories (below). Only elements which are
90 meant to directly contain text data have a mixed content model, where
91 text data and inline elements may be intermixed. This is unlike the
92 much looser HTML_ document model, where paragraphs and text data may
93 occur at the same level.
99 Structural elements may only contain child elements; they do not
100 directly contain text data. Structural elements may contain body
101 elements or further structural elements. Structural elements can only
102 be child elements of other structural elements.
104 Category members: document_, section_, topic_, sidebar_
107 Structural Subelements
108 ----------------------
110 Structural subelements are child elements of structural elements.
111 Simple structuctural subelements (title_, subtitle_) contain text
112 data; the others are compound and do not directly contain text data.
114 Category members: title_, subtitle_, decoration_, docinfo_,
118 Bibliographic Elements
119 ``````````````````````
121 The docinfo_ element is an optional child of document_. It groups
122 bibliographic elements together. All bibliographic elements except
123 authors_ and field_ contain text data. authors_ contains further
124 bibliographic elements (most notably author_). field_ contains
125 field_name_ and field_body_ body subelements.
127 Category members: address_, author_, authors_, contact_, copyright_,
128 date_, field_, organization_, revision_, status_, version_
134 The decoration_ element is also an optional child of document_. It
135 groups together elements used to generate page headers and footers.
137 Category members: footer_, header_
143 Body elements are contained within structural elements and compound
144 body elements. There are two subcategories of body elements: simple
147 Category members: admonition_, attention_, block_quote_, bullet_list_,
148 caution_, citation_, comment_, compound_, container_, danger_,
149 definition_list_, doctest_block_, enumerated_list_, error_,
150 field_list_, figure_, footnote_, hint_, image_, important_,
151 line_block_, literal_block_, note_, option_list_, paragraph_,
152 pending_, raw_, rubric_, substitution_definition_, system_message_,
153 table_, target_, tip_, warning_
159 Simple body elements are empty or directly contain text data. Those
160 that contain text data may also contain inline elements. Such
161 elements therefore have a "mixed content model".
163 Category members: comment_, doctest_block_, image_, literal_block_,
164 math_block_, paragraph_, pending_, raw_, rubric_, substitution_definition_,
168 Compound Body Elements
169 ----------------------
171 Compound body elements contain local substructure (body subelements)
172 and further body elements. They do not directly contain text data.
174 Category members: admonition_, attention_, block_quote_, bullet_list_,
175 caution_, citation_, compound_, container_, danger_, definition_list_,
176 enumerated_list_, error_, field_list_, figure_, footnote_, hint_,
177 important_, line_block, note_, option_list_, system_message_, table_,
184 Compound body elements contain specific subelements (e.g. bullet_list_
185 contains list_item_). Subelements may themselves be compound elements
186 (containing further child elements, like field_) or simple data
187 elements (containing text data, like field_name_). These subelements
188 always occur within specific parent elements, never at the body
189 element level (beside paragraphs, etc.).
191 Category members (simple): attribution_, caption_, classifier_,
192 colspec_, field_name_, label_, line_, option_argument_,
193 option_string_, term_
195 Category members (compound): definition_, definition_list_item_,
196 description_, entry_, field_, field_body_, legend_, list_item_,
197 option_, option_group_, option_list_item_, row_, tbody_, tgroup_,
204 Inline elements directly contain text data, and may also contain
205 further inline elements. Inline elements are contained within simple
206 body elements. Most inline elements have a "mixed content model".
208 Category members: abbreviation_, acronym_, citation_reference_,
209 emphasis_, footnote_reference_, generated_, image_, inline_, literal_,
210 math_, problematic_, reference_, strong_, subscript_,
211 substitution_reference_, superscript_, target_, title_reference_, raw_
214 .. _HTML: http://www.w3.org/MarkUp/
215 .. _DocBook: http://docbook.org/tdg/en/html/docbook.html
216 .. _XMLSpec: http://www.w3.org/XML/1998/06/xmlspec-report.htm
223 .. contents:: :local:
226 Each element in the DTD (document type definition) is described in its
227 own section below. Each section contains an introduction plus the
228 following subsections:
230 * Details (of element relationships and semantics):
232 - Category: One or more references to the element categories in
233 `Element Hierarchy`_ above. Some elements belong to more than one
236 - Parents: A list of elements which may contain the element.
238 - Children: A list of elements which may occur within the element.
240 - Analogues: Describes analogous elements in well-known document
241 models such as HTML_ or DocBook_. Lists similarities and
244 - Processing: Lists formatting or rendering recommendations for the
249 The formal XML content model from the `Docutils DTD`_, followed by:
251 - Attributes: Describes (or refers to descriptions of) the possible
252 values and semantics of each attribute.
254 - Parameter Entities: Lists the parameter entities which directly or
255 indirectly include the element.
257 * Examples: reStructuredText_ examples are shown along with
258 fragments of the document trees resulting from parsing.
259 _`Pseudo-XML` is used for the results of parsing and processing.
260 Pseudo-XML is a representation of XML where nesting is indicated by
261 indentation and end-tags are not shown. Some of the precision of
262 real XML is given up in exchange for easier readability. For
263 example, the following are equivalent:
268 <section ids="a-title" names="a title">
269 <title>A Title</title>
270 <paragraph>A paragraph.</paragraph>
277 <section ids="a-title" names="a title">
285 Many of the element reference sections below are marked "_`to be
286 completed`". Please help complete this document by contributing to
293 The ``abbreviation`` element is an inline element used to represent an
294 abbreviation being used in the document. An example of an abbreviation is 'St'
295 being used instead of 'Street'.
304 All elements employing the %inline.elements; parameter entities in their
305 content models may contain ``abbreviation``.
308 ``abbreviation`` elements may contain text data plus `inline elements`_.
311 ``abbreviation`` is analogous to the HTML "abbr" element.
321 The ``abbreviation`` element contains only the `common attributes`_:
322 ids_, names_, dupnames_, source_, and classes_.
327 The ``abbreviation`` element is not exposed in default restructured text. It
328 can only be accessed through custom roles.
330 Pseudo-XML_ example from a custom `:abbr:` role::
333 <abbreviation explanation="Street">
335 is a common abbreviation for "street".
347 The ``address`` element holds the surface mailing address information
348 for the author (individual or group) of the document, or a third-party
349 contact address. Its structure is identical to that of the
350 literal_block_ element: whitespace is significant, especially
358 `Bibliographic Elements`_
361 The following elements may contain ``address``: docinfo_, authors_
364 ``address`` elements contain text data plus `inline elements`_.
367 ``address`` is analogous to the DocBook "address" element.
370 As with the literal_block_ element, newlines and other whitespace
371 is significant and must be preserved. However, a monospaced
372 typeface need not be used.
385 The ``address`` element contains the `common attributes`_ (ids_,
386 names_, dupnames_, source_, and classes_), plus `xml:space`_.
389 The `%bibliographic.elements;`_ parameter entity directly includes
396 reStructuredText_ source::
401 :Address: 123 Example Ave.
404 Complete pseudo-XML_ result after parsing and applying transforms::
406 <document ids="document-title" names="document title">
414 See docinfo_ for a more complete example, including processing
421 This element is a generic, titled admonition. Also see the specific
422 admonition elements Docutils offers (in alphabetical order): caution_,
423 danger_, error_, hint_, important_, note_, tip_, warning_.
430 `Compound Body Elements`_
433 All elements employing the `%body.elements;`_ or
434 `%structure.model;`_ parameter entities in their content models
435 may contain ``admonition``.
438 ``admonition`` elements begin with a title_ and may contain one or
439 more `body elements`_.
442 ``admonition`` has no direct analogues in common DTDs. It can be
443 emulated with primitives and type effects.
446 Rendered distinctly (inset and/or in a box, etc.).
454 (title_, (`%body.elements;`_)+)
457 The ``admonition`` element contains only the `common attributes`_:
458 ids_, names_, dupnames_, source_, and classes_.
461 The `%body.elements;`_ parameter entity directly includes
462 ``admonition``. The `%structure.model;`_ parameter entity
463 indirectly includes ``admonition``.
469 reStructuredText source::
471 .. admonition:: And, by the way...
473 You can make up your own admonition too.
475 Pseudo-XML_ fragment from simple parsing::
477 <admonition class="admonition-and-by-the-way">
481 You can make up your own admonition too.
487 The ``attention`` element is an admonition, a distinctive and
488 self-contained notice. Also see the other admonition elements
489 Docutils offers (in alphabetical order): caution_, danger_, error_,
490 hint_, important_, note_, tip_, warning_, and the generic admonition_.
497 `Compound Body Elements`_
500 All elements employing the `%body.elements;`_ or
501 `%structure.model;`_ parameter entities in their content models
502 may contain ``attention``.
505 ``attention`` elements contain one or more `body elements`_.
508 ``attention`` has no direct analogues in common DTDs. It can be
509 emulated with primitives and type effects.
512 Rendered distinctly (inset and/or in a box, etc.), with the
513 generated title "Attention!" (or similar).
521 (`%body.elements;`_)+
524 The ``attention`` element contains only the `common attributes`_:
525 ids_, names_, dupnames_, source_, and classes_.
528 The `%body.elements;`_ parameter entity directly includes
529 ``attention``. The `%structure.model;`_ parameter entity
530 indirectly includes ``attention``.
536 reStructuredText source::
538 .. Attention:: All your base are belong to us.
540 Pseudo-XML_ fragment from simple parsing::
544 All your base are belong to us.
556 The ``author`` element holds the name of the author of the document.
563 `Bibliographic Elements`_
566 The following elements may contain ``author``: docinfo_, authors_
569 ``author`` elements may contain text data plus `inline elements`_.
572 ``author`` is analogous to the DocBook "author" element.
586 The ``author`` element contains only the `common attributes`_:
587 ids_, names_, dupnames_, source_, and classes_.
590 The `%bibliographic.elements;`_ parameter entity directly includes
597 reStructuredText_ source::
602 :Author: J. Random Hacker
604 Complete pseudo-XML_ result after parsing and applying transforms::
606 <document ids="document-title" names="document title">
613 See docinfo_ for a more complete example, including processing
620 The ``authors`` element is a container for author information for
621 documents with multiple authors.
628 `Bibliographic Elements`_
631 Only the docinfo_ element contains ``authors``.
634 ``authors`` elements may contain the following elements: author_,
635 organization_, address_, contact_
638 ``authors`` is analogous to the DocBook "authors" element.
649 ((author_, organization_?, address_?, contact_?)+)
652 The ``authors`` element contains only the `common attributes`_:
653 ids_, names_, dupnames_, source_, and classes_.
656 The `%bibliographic.elements;`_ parameter entity directly includes
663 reStructuredText_ source::
668 :Authors: J. Random Hacker; Jane Doe
670 Complete pseudo-XML_ result after parsing and applying transforms::
672 <document ids="document-title" names="document title">
682 In reStructuredText, multiple author's names are separated with
683 semicolons (";") or commas (","); semicolons take precedence. There
684 is currently no way to represent the author's organization, address,
685 or contact in a reStructuredText "Authors" field.
687 See docinfo_ for a more complete example, including processing
694 The ``block_quote`` element is used for quotations set off from the
695 main text (standalone).
702 `Compound Body Elements`_
705 All elements employing the `%body.elements;`_ or
706 `%structure.model;`_ parameter entities in their content models
707 may contain ``block_quote``.
710 ``block_quote`` elements contain `body elements`_ followed by an
711 optional attribution_ element.
714 ``block_quote`` is analogous to the "blockquote" element in both
718 ``block_quote`` elements serve to set their contents off from the
719 main text, typically with indentation and/or other decoration.
727 ((`%body.elements;`_)+, attribution_?)
730 The ``block_quote`` element contains only the `common
731 attributes`_: ids_, names_, dupnames_, source_, and classes_.
734 The `%body.elements;`_ parameter entity directly includes
735 ``block_quote``. The `%structure.model;`_ parameter entity
736 indirectly includes ``block_quote``.
742 reStructuredText source::
744 As a great paleontologist once said,
746 This theory, that is mine, is mine.
750 Pseudo-XML_ fragment from simple parsing::
753 As a great paleontologist once said,
756 This theory, that is mine, is mine.
764 The ``bullet_list`` element contains list_item_ elements which are
765 uniformly marked with bullets. Bullets are typically simple dingbats
766 (symbols) such as circles and squares.
773 `Compound Body Elements`_
776 All elements employing the `%body.elements;`_ or
777 `%structure.model;`_ parameter entities in their content models
778 may contain ``bullet_list``.
781 ``bullet_list`` elements contain one or more list_item_ elements.
784 ``bullet_list`` is analogous to the HTML "ul" element and to the
785 DocBook "itemizedlist" element. HTML's "ul" is short for
786 "unordered list", which we consider to be a misnomer. "Unordered"
787 implies that the list items may be randomly rearranged without
788 affecting the meaning of the list. Bullet lists *are* often
789 ordered; the ordering is simply left implicit.
792 Each list item should begin a new vertical block, prefaced by a
804 The ``bullet_list`` element contains the `common attributes`_
805 (ids_, names_, dupnames_, source_, and classes_), plus bullet_.
807 ``bullet`` is used to record the style of bullet from the input
808 data. In documents processed from reStructuredText_, it contains
809 one of "-", "+", or "*". It may be ignored in processing.
812 The `%body.elements;`_ parameter entity directly includes
813 ``bullet_list``. The `%structure.model;`_ parameter entity
814 indirectly includes ``bullet_list``.
820 reStructuredText_ source::
822 - Item 1, paragraph 1.
828 Pseudo-XML_ fragment from simple parsing::
830 <bullet_list bullet="-">
840 See list_item_ for another example.
852 The ``caution`` element is an admonition, a distinctive and
853 self-contained notice. Also see the other admonition elements
854 Docutils offers (in alphabetical order): attention_, danger_, error_,
855 hint_, important_, note_, tip_, warning_, and the generic admonition_.
862 `Compound Body Elements`_
865 All elements employing the `%body.elements;`_ or
866 `%structure.model;`_ parameter entities in their content models
867 may contain ``caution``.
870 ``caution`` elements contain one or more `body elements`_.
873 ``caution`` is analogous to the DocBook "caution" element.
876 Rendered distinctly (inset and/or in a box, etc.), with the
877 generated title "Caution" (or similar).
885 (`%body.elements;`_)+
888 The ``caution`` element contains only the `common attributes`_:
889 ids_, names_, dupnames_, source_, and classes_.
892 The `%body.elements;`_ parameter entity directly includes
893 ``caution``. The `%structure.model;`_ parameter entity
894 indirectly includes ``caution``.
900 reStructuredText source::
902 .. Caution:: Don't take any wooden nickels.
904 Pseudo-XML_ fragment from simple parsing::
908 Don't take any wooden nickels.
917 ``citation_reference``
918 ======================
926 The ``classifier`` element contains the classification or type of the
927 term_ being defined in a definition_list_. For example, it can be
928 used to indicate the type of a variable.
935 `Body Subelements`_ (simple)
938 Only the definition_list_item_ element contains ``classifier``.
941 ``classifier`` elements may contain text data plus `inline elements`_.
944 ``classifier`` has no direct analogues in common DTDs. It can be
945 emulated with primitives or type effects.
948 See definition_list_item_.
959 The ``classifier`` element contains only the `common attributes`_:
960 ids_, names_, dupnames_, source_, and classes_.
966 Here is a hypothetical data dictionary. reStructuredText_ source::
971 Temporary index variable.
973 Pseudo-XML_ fragment from simple parsing::
976 <definition_list_item>
984 <definition_list_item>
991 Temporary index variable.
998 The ``colspec`` element contains the `common attributes`_ (ids_,
999 names_, dupnames_, source_, and classes_), plus `stub`_.
1020 The ``contact`` element holds contact information for the author
1021 (individual or group) of the document, or a third-party contact. It
1022 is typically used for an email or web address.
1029 `Bibliographic Elements`_
1032 The following elements may contain ``contact``: docinfo_, authors_
1035 ``contact`` elements may contain text data plus `inline
1039 ``contact`` is analogous to the DocBook "email" element. The HTML
1040 "address" element serves a similar purpose.
1054 The ``contact`` element contains only the `common attributes`_:
1055 ids_, names_, dupnames_, source_, and classes_.
1057 :Parameter Entities:
1058 The `%bibliographic.elements;`_ parameter entity directly includes
1065 reStructuredText_ source::
1070 :Contact: jrh@example.com
1072 Complete pseudo-XML_ result after parsing and applying transforms::
1074 <document ids="document-title" names="document title">
1079 <reference refuri="mailto:jrh@example.com">
1082 See docinfo_ for a more complete example, including processing
1095 The ``copyright`` element contains the document's copyright statement.
1102 `Bibliographic Elements`_
1105 Only the docinfo_ element contains ``copyright``.
1108 ``copyright`` elements may contain text data plus `inline
1112 ``copyright`` is analogous to the DocBook "copyright" element.
1126 The ``copyright`` element contains only the `common attributes`_:
1127 ids_, names_, dupnames_, source_, and classes_.
1129 :Parameter Entities:
1130 The `%bibliographic.elements;`_ parameter entity directly includes
1137 reStructuredText_ source::
1142 :Copyright: This document has been placed in the public domain.
1144 Complete pseudo-XML_ result after parsing and applying transforms::
1146 <document ids="document-title" names="document title">
1151 This document has been placed in the public domain.
1153 See docinfo_ for a more complete example, including processing
1160 The ``danger`` element is an admonition, a distinctive and
1161 self-contained notice. Also see the other admonition elements
1162 Docutils offers (in alphabetical order): attention_, caution_, error_,
1163 hint_, important_, note_, tip_, warning_, and the generic admonition_.
1170 `Compound Body Elements`_
1173 All elements employing the `%body.elements;`_ or
1174 `%structure.model;`_ parameter entities in their content models
1175 may contain ``danger``.
1178 ``danger`` elements contain one or more `body elements`_.
1181 ``danger`` has no direct analogues in common DTDs. It can be
1182 emulated with primitives and type effects.
1185 Rendered distinctly (inset and/or in a box, etc.), with the
1186 generated title "!DANGER!" (or similar).
1194 (`%body.elements;`_)+
1197 The ``danger`` element contains only the `common attributes`_:
1198 ids_, names_, dupnames_, source_, and classes_.
1200 :Parameter Entities:
1201 The `%body.elements;`_ parameter entity directly includes
1202 ``danger``. The `%structure.model;`_ parameter entity
1203 indirectly includes ``danger``.
1209 reStructuredText source::
1211 .. DANGER:: Mad scientist at work!
1213 Pseudo-XML_ fragment from simple parsing::
1217 Mad scientist at work!
1223 The ``date`` element contains the date of publication, release, or
1224 last modification of the document.
1231 `Bibliographic Elements`_
1234 Only the docinfo_ element contains ``date``.
1237 ``date`` elements may contain text data plus `inline elements`_.
1240 ``date`` is analogous to the DocBook "date" element.
1243 Often used with the RCS/CVS keyword "Date". See docinfo_.
1254 The ``date`` element contains only the `common attributes`_:
1255 ids_, names_, dupnames_, source_, and classes_.
1257 :Parameter Entities:
1258 The `%bibliographic.elements;`_ parameter entity directly includes
1265 reStructuredText_ source::
1272 Complete pseudo-XML_ result after parsing and applying transforms::
1274 <document ids="document-title" names="document title">
1281 See docinfo_ for a more complete example, including processing
1288 The ``decoration`` element is a container for header_ and footer_
1289 elements and potential future extensions. These elements are used for
1290 notes, time/datestamp, processing information, etc.
1297 `Structural Subelements`_
1300 Only the document_ element contains ``decoration``.
1303 ``decoration`` elements may contain `decorative elements`_.
1306 There are no direct analogies to ``decoration`` in HTML or in
1307 DocBook. Equivalents are typically constructed from primitives
1308 and/or generated by the processing system.
1311 See the individual `decorative elements`_.
1319 (header_?, footer_?)
1321 Although the content model doesn't specifically require contents, no
1322 empty ``decoration`` elements are ever created.
1325 The ``decoration`` element contains only the `common attributes`_:
1326 ids_, names_, dupnames_, source_, and classes_.
1332 reStructuredText_ source::
1336 Complete pseudo-XML_ result after parsing and applying transforms,
1337 assuming that the datestamp command-line option or configuration
1338 setting has been supplied::
1344 Generated on: 2002-08-20.
1352 The ``definition`` element is a container for the body elements used
1353 to define a term_ in a definition_list_.
1360 `Body Subelements`_ (compound)
1363 Only definition_list_item_ elements contain ``definition``.
1366 ``definition`` elements may contain `body elements`_.
1369 ``definition`` is analogous to the HTML "dd" element and to the
1370 DocBook "listitem" element (inside a "variablelistentry" element).
1373 See definition_list_item_.
1381 (`%body.elements;`_)+
1384 The ``definition`` element contains only the `common attributes`_:
1385 ids_, names_, dupnames_, source_, and classes_.
1391 See the examples for the definition_list_, definition_list_item_, and
1392 classifier_ elements.
1398 The ``definition_list`` element contains a list of terms and their
1399 definitions. It can be used for glossaries or dictionaries, to
1400 describe or classify things, for dialogues, or to itemize subtopics
1401 (such as in this reference).
1408 `Compound Body Elements`_
1411 All elements employing the `%body.elements;`_ or
1412 `%structure.model;`_ parameter entities in their content models
1413 may contain ``definition_list``.
1416 ``definition_list`` elements contain one or more
1417 definition_list_item_ elements.
1420 ``definition_list`` is analogous to the HTML "dl" element and to
1421 the DocBook "variablelist" element.
1424 See definition_list_item_.
1432 (definition_list_item_ +)
1435 The ``definition_list`` element contains only the `common
1436 attributes`_: ids_, names_, dupnames_, source_, and classes_.
1438 :Parameter Entities:
1439 The `%body.elements;`_ parameter entity directly includes
1440 ``definition_list``. The `%structure.model;`_ parameter entity
1441 indirectly includes ``definition_list``.
1447 reStructuredText_ source::
1453 The ' : ' indicates a classifier in
1454 definition list item terms only.
1456 Pseudo-XML_ fragment from simple parsing::
1459 <definition_list_item>
1465 <definition_list_item>
1472 The ' : ' indicates a classifier in
1473 definition list item terms only.
1475 See definition_list_item_ and classifier_ for further examples.
1478 ``definition_list_item``
1479 ========================
1481 The ``definition_list_item`` element contains a single
1482 term_/definition_ pair (with optional classifier_).
1489 `Body Subelements`_ (compound)
1492 Only the definition_list_ element contains
1493 ``definition_list_item``.
1496 ``definition_list_item`` elements each contain a single term_,
1497 an optional classifier_, and a definition_.
1500 ``definition_list_item`` is analogous to the DocBook
1501 "variablelistentry" element.
1504 The optional classifier_ can be rendered differently from the
1505 term_. They should be separated visually, typically by spaces
1506 plus a colon or dash.
1514 (term_, classifier_?, definition_)
1517 The ``definition_list_item`` element contains only the `common
1518 attributes`_: ids_, names_, dupnames_, source_, and classes_.
1524 reStructuredText_ source::
1526 Tyrannosaurus Rex : carnivore
1527 Big and scary; the "Tyrant King".
1529 Brontosaurus : herbivore
1530 All brontosauruses are thin at one end,
1531 much much thicker in the middle
1532 and then thin again at the far end.
1536 Pseudo-XML_ fragment from simple parsing::
1539 <definition_list_item>
1546 Big and scary; the "Tyrant King".
1547 <definition_list_item>
1554 All brontosauruses are thin at one end,
1555 much much thicker in the middle
1556 and then thin again at the far end.
1560 See definition_list_ and classifier_ for further examples.
1566 The ``description`` element contains body elements, describing the
1567 purpose or effect of a command-line option or group of options.
1577 Only the option_list_item_ element contains ``description``.
1580 ``description`` elements may contain `body elements`_.
1583 ``description`` has no direct analogues in common DTDs.
1594 (`%body.elements;`_)+
1597 The ``description`` element contains only the `common attributes`_:
1598 ids_, names_, dupnames_, source_, and classes_.
1604 See the examples for the option_list_ element.
1610 The ``docinfo`` element is a container for document bibliographic
1611 data, or meta-data (data about the document). It corresponds to the
1612 front matter of a book, such as the title page and copyright page.
1619 `Structural Subelements`_
1622 Only the document_ element contains ``docinfo``.
1625 ``docinfo`` elements contain `bibliographic elements`_.
1628 ``docinfo`` is analogous to DocBook "info" elements ("bookinfo"
1629 etc.). There are no directly analogous HTML elements; the "meta"
1630 element carries some of the same information, albeit invisibly.
1633 The ``docinfo`` element may be rendered as a two-column table or
1634 in other styles. It may even be invisible or omitted from the
1635 processed output. Meta-data may be extracted from ``docinfo``
1636 children; for example, HTML ``<meta>`` tags may be constructed.
1638 When Docutils_ transforms a reStructuredText_ field_list_ into a
1639 ``docinfo`` element (see the examples below), RCS/CVS keywords are
1640 normally stripped from simple (one paragraph) field bodies. For
1641 complete details, please see `RCS Keywords`_ in the
1642 `reStructuredText Markup Specification`_.
1644 .. _RCS Keywords: rst/restructuredtext.html#rcs-keywords
1652 (`%bibliographic.elements;`_)+
1655 The ``docinfo`` element contains only the `common attributes`_:
1656 ids_, names_, dupnames_, source_, and classes_.
1662 Docinfo is represented in reStructuredText_ by a field_list_ in a
1663 bibliographic context: the first non-comment element of a document_,
1664 after any document title_/subtitle_. The field list is transformed
1665 into a ``docinfo`` element and its children by a transform. Source::
1670 :Author: J. Random Hacker
1671 :Contact: jrh@example.com
1673 :Status: Work In Progress
1675 :Filename: $RCSfile$
1676 :Copyright: This document has been placed in the public domain.
1678 Complete pseudo-XML_ result after parsing and applying transforms::
1680 <document ids="docinfo-example" names="docinfo example">
1687 <reference refuri="mailto:jrh@example.com">
1702 This document has been placed in the public domain.
1704 Note that "Filename" is a non-standard ``docinfo`` field, so becomes a
1705 generic ``field`` element. Also note that the "RCSfile" keyword
1706 syntax has been stripped from the "Filename" data.
1708 See field_list_ for an example in a non-bibliographic context. Also
1709 see the individual examples for the various `bibliographic elements`_.
1715 The ``doctest_block`` element is a Python-specific variant of
1716 literal_block_. It is a block of text where line breaks and
1717 whitespace are significant and must be preserved. ``doctest_block``
1718 elements are used for interactive Python interpreter sessions, which
1719 are distinguished by their input prompt: ``>>>``. They are meant to
1720 illustrate usage by example, and provide an elegant and powerful
1721 testing environment via the `doctest module`_ in the Python standard
1725 http://www.python.org/doc/current/lib/module-doctest.html
1732 `Simple Body Elements`_
1735 All elements employing the `%body.elements;`_ or
1736 `%structure.model;`_ parameter entities in their content models
1737 may contain ``doctest_block``.
1740 ``doctest_block`` elements may contain text data plus `inline
1744 ``doctest_block`` is analogous to the HTML "pre" element and to
1745 the DocBook "programlisting" and "screen" elements.
1748 As with literal_block_, ``doctest_block`` elements are typically
1749 rendered in a monospaced typeface. It is crucial that all
1750 whitespace and line breaks are preserved in the rendered form.
1761 The ``doctest_block`` element contains the `common attributes`_
1762 (ids_, names_, dupnames_, source_, and classes_), plus `xml:space`_.
1764 :Parameter Entities:
1765 The `%body.elements;`_ parameter entity directly includes
1766 ``doctest_block``. The `%structure.model;`_ parameter entity
1767 indirectly includes ``doctest_block``.
1773 reStructuredText source::
1775 This is an ordinary paragraph.
1777 >>> print 'this is a Doctest block'
1778 this is a Doctest block
1780 Pseudo-XML_ fragment from simple parsing::
1783 This is an ordinary paragraph.
1784 <doctest_block xml:space="preserve">
1785 >>> print 'this is a Doctest block'
1786 this is a Doctest block
1792 The ``document`` element is the root (topmost) element of the Docutils
1793 document tree. ``document`` is the direct or indirect ancestor of
1794 every other element in the tree. It encloses the entire document
1795 tree. It is the starting point for a document.
1802 `Structural Elements`_
1805 The ``document`` element has no parents.
1808 ``document`` elements may contain `structural subelements`_,
1809 `structural elements`_, and `body elements`_.
1812 ``document`` is analogous to the HTML "html" element and to
1813 several DocBook elements such as "book".
1821 ( (title_, subtitle_?)?,
1823 (docinfo_, transition_?)?,
1824 `%structure.model;`_ )
1826 Depending on the source of the data and the stage of processing, the
1827 "document" may not initially contain a "title". A document title is
1828 not directly representable in reStructuredText_. Instead, a lone
1829 top-level section may have its title promoted to become the document
1830 title_, and similarly for a lone second-level (sub)section's title to
1831 become the document subtitle_.
1833 The contents of "decoration_" may be specified in a document,
1834 constructed programmatically, or both. The "docinfo_" may be
1835 transformed from an initial field_list_.
1837 See the `%structure.model;`_ parameter entity for details of the body
1841 The ``document`` element contains the `common attributes`_ (ids_,
1842 names_, dupnames_, source_, and classes_), plus an optional title__
1843 attribute which stores the document title metadata.
1845 __ `title (attribute)`_
1851 reStructuredText_ source::
1858 Complete pseudo-XML_ result from simple parsing::
1861 <section ids="a-title" names="a title">
1867 After applying transforms, the section title is promoted to become the
1870 <document ids="a-title" names="a title">
1892 The ``enumerated_list`` element contains list_item_ elements which are
1893 uniformly marked with enumerator labels.
1900 `Compound Body Elements`_
1903 All elements employing the `%body.elements;`_ or
1904 `%structure.model;`_ parameter entities in their content models
1905 may contain ``enumerated_list``.
1908 ``enumerated_list`` elements contain one or more list_item_
1912 ``enumerated_list`` is analogous to the HTML "ol" element and to
1913 the DocBook "orderedlist" element.
1916 Each list item should begin a new vertical block, prefaced by a
1917 enumeration marker (such as "1.").
1928 The ``enumerated_list`` element contains the `common attributes`_
1929 (ids_, names_, dupnames_, source_, and classes_), plus enumtype_,
1930 prefix_, suffix_, and start_.
1932 ``enumtype`` is used to record the intended enumeration sequence,
1933 one of "arabic" (1, 2, 3, ...), "loweralpha" (a, b, c, ..., z),
1934 "upperalpha" (A, B, C, ..., Z), "lowerroman" (i, ii, iii, iv, ...,
1935 mmmmcmxcix [4999]), or "upperroman" (I, II, III, IV, ...,
1938 ``prefix`` stores the formatting characters used before the
1939 enumerator. In documents originating from reStructuredText_ data,
1940 it will contain either "" (empty string) or "(" (left
1941 parenthesis). It may or may not affect processing.
1943 ``suffix`` stores the formatting characters used after the
1944 enumerator. In documents originating from reStructuredText_ data,
1945 it will contain either "." (period) or ")" (right parenthesis).
1946 Depending on the capabilities of the output format, this attribute
1947 may or may not affect processing.
1949 ``start`` contains the ordinal value of the first item in the
1950 list, in decimal. For lists beginning at value 1 ("1", "a", "A",
1951 "i", or "I"), this attribute may be omitted.
1953 :Parameter Entities:
1954 The `%body.elements;`_ parameter entity directly includes
1955 ``enumerated_list``. The `%structure.model;`_ parameter entity
1956 indirectly includes ``enumerated_list``.
1962 reStructuredText_ source::
1972 Pseudo-XML_ fragment from simple parsing::
1974 <enumerated_list enumtype="arabic" prefix="" suffix=".">
1978 <enumerated_list enumtype="upperalpha" prefix="(" suffix=")">
1992 See list_item_ for another example.
1998 The ``error`` element is an admonition, a distinctive and
1999 self-contained notice. Also see the other admonition elements
2000 Docutils offers (in alphabetical order): attention_, caution_,
2001 danger_, hint_, important_, note_, tip_, warning_, and the generic
2009 `Compound Body Elements`_
2012 All elements employing the `%body.elements;`_ or
2013 `%structure.model;`_ parameter entities in their content models
2014 may contain ``error``.
2017 ``error`` elements contain one or more `body elements`_.
2020 ``error`` has no direct analogues in common DTDs. It can be
2021 emulated with primitives and type effects.
2024 Rendered distinctly (inset and/or in a box, etc.), with the
2025 generated title "Error" (or similar).
2033 (`%body.elements;`_)+
2036 The ``error`` element contains only the `common attributes`_: ids_,
2037 names_, dupnames_, source_, and classes_.
2039 :Parameter Entities:
2040 The `%body.elements;`_ parameter entity directly includes
2041 ``error``. The `%structure.model;`_ parameter entity indirectly
2048 reStructuredText source::
2050 .. Error:: Does not compute.
2052 Pseudo-XML_ fragment from simple parsing::
2062 The ``field`` element contains a pair of field_name_ and field_body_
2073 The following elements may contain ``field``: docinfo_,
2077 Each ``field`` element contains one field_name_ and one
2078 field_body_ element.
2081 ``field`` has no direct analogues in common DTDs.
2092 (field_name_, field_body_)
2095 The ``field`` element contains only the `common attributes`_:
2096 ids_, names_, dupnames_, source_, and classes_.
2098 :Parameter Entities:
2099 The `%bibliographic.elements;`_ parameter entity directly includes
2106 See the examples for the field_list_ and docinfo_ elements.
2112 The ``field_body`` element contains body elements. It is analogous to
2113 a database field's data.
2123 Only the field_ element contains ``field_body``.
2126 ``field_body`` elements may contain `body elements`_.
2129 ``field_body`` has no direct analogues in common DTDs.
2140 (`%body.elements;`_)*
2143 The ``field_body`` element contains only the `common attributes`_:
2144 ids_, names_, dupnames_, source_, and classes_.
2150 See the examples for the field_list_ and docinfo_ elements.
2156 The ``field_list`` element contains two-column table-like structures
2157 resembling database records (label & data pairs). Field lists are
2158 often meant for further processing. In reStructuredText_, field lists
2159 are used to represent bibliographic fields (contents of the docinfo_
2160 element) and `directive options`_.
2166 `Compound Body Elements`_
2169 All elements employing the `%body.elements;`_ or
2170 `%structure.model;`_ parameter entities in their content models
2171 may contain ``field_list``.
2174 ``field_list`` elements contain one or more field_ elements.
2177 ``field_list`` has no direct analogues in common DTDs. It can be
2178 emulated with primitives such as tables.
2181 A ``field_list`` is typically rendered as a two-column list, where
2182 the first column contains "labels" (usually with a colon suffix).
2183 However, field lists are often used for extension syntax or
2184 special processing. Such structures do not survive as field lists
2196 The ``field_list`` element contains only the `common attributes`_:
2197 ids_, names_, dupnames_, source_, and classes_.
2199 :Parameter Entities:
2200 The `%body.elements;`_ parameter entity directly includes
2201 ``field_list``. The `%structure.model;`_ parameter entity
2202 indirectly includes ``field_list``.
2208 reStructuredText_ source::
2213 :Parameter i: integer
2215 Pseudo-XML_ fragment from simple parsing::
2243 .. _directive options: rst/restructuredtext.html#directive-options
2249 The ``field_name`` element contains text; it is analogous to a
2250 database field's name.
2257 `Body Subelements`_ (simple)
2260 Only the field_ element contains ``field_name``.
2263 ``field_name`` elements may contain text data plus `inline elements`_.
2266 ``field_name`` has no direct analogues in common DTDs.
2280 The ``field_name`` element contains only the `common attributes`_:
2281 ids_, names_, dupnames_, source_, and classes_.
2287 See the examples for the field_list_ and docinfo_ elements.
2299 The ``footer`` element is a container element whose contents are meant
2300 to appear at the bottom of a web page, or repeated at the bottom of
2301 every printed page. The ``footer`` element may contain processing
2302 information (datestamp, a link to Docutils_, etc.) as well as custom
2310 `Decorative Elements`_
2313 Only the decoration_ element contains ``footer``.
2316 ``footer`` elements may contain `body elements`_.
2319 ``footer`` is analogous to the HTML5 "footer" element
2320 There are no direct analogies to ``footer`` in HTML4 or DocBook.
2321 Equivalents are typically constructed from primitives and/or
2322 generated by the processing system.
2330 (`%body.elements;`_)+
2333 The ``footer`` element contains only the `common attributes`_:
2334 ids_, names_, dupnames_, source_, and classes_.
2340 reStructuredText_ source::
2344 Complete pseudo-XML_ result after parsing and applying transforms,
2345 assuming that the datestamp command-line option or configuration
2346 setting has been supplied::
2352 Generated on: 2002-08-20.
2363 ``footnote_reference``
2364 ======================
2372 Docutils wraps ``generated`` elements around text that is inserted
2373 (generated) by Docutils; i.e., text that was not in the document, like
2374 section numbers inserted by the "sectnum" directive.
2382 The ``header`` element is a container element whose contents are meant
2383 to appear at the top of a web page, or at the top of every printed
2391 `Decorative Elements`_
2394 Only the decoration_ element contains ``header``.
2397 ``header`` elements may contain `body elements`_.
2400 ``header`` is analogous to the HTML5 "header" element
2401 There are no direct analogies to ``header`` in HTML4 or DocBook.
2402 Equivalents are typically constructed from primitives and/or
2403 generated by the processing system.
2411 (`%body.elements;`_)+
2414 The ``header`` element contains only the `common attributes`_:
2415 ids_, names_, dupnames_, source_, and classes_.
2421 reStructuredText source fragment::
2423 .. header:: This space for rent.
2425 Pseudo-XML_ fragment from simple parsing::
2431 This space for rent.
2437 The ``hint`` element is an admonition, a distinctive and
2438 self-contained notice. Also see the other admonition elements
2439 Docutils offers (in alphabetical order): attention_, caution_,
2440 danger_, error_, important_, note_, tip_, warning_, and the generic
2448 `Compound Body Elements`_
2451 All elements employing the `%body.elements;`_ or
2452 `%structure.model;`_ parameter entities in their content models
2453 may contain ``hint``.
2456 ``hint`` elements contain one or more `body elements`_.
2459 ``hint`` has no direct analogues in common DTDs. It can be
2460 emulated with primitives and type effects.
2463 Rendered distinctly (inset and/or in a box, etc.), with the
2464 generated title "Hint" (or similar).
2472 (`%body.elements;`_)+
2475 The ``hint`` element contains only the `common attributes`_: ids_,
2476 names_, dupnames_, source_, and classes_.
2478 :Parameter Entities:
2479 The `%body.elements;`_ parameter entity directly includes
2480 ``hint``. The `%structure.model;`_ parameter entity indirectly
2487 reStructuredText source::
2489 .. Hint:: It's bigger than a bread box.
2491 Pseudo-XML_ fragment from simple parsing::
2495 It's bigger than a bread box.
2502 The ``image`` element contains the `common attributes`_ (ids_,
2503 names_, dupnames_, source_, and classes_), plus uri, alt, height_,
2512 The ``important`` element is an admonition, a distinctive and
2513 self-contained notice. Also see the other admonition elements
2514 Docutils offers (in alphabetical order): attention_, caution_,
2515 danger_, error_, hint_, note_, tip_, warning_, and the generic
2523 `Compound Body Elements`_
2526 All elements employing the `%body.elements;`_ or
2527 `%structure.model;`_ parameter entities in their content models
2528 may contain ``important``.
2531 ``important`` elements contain one or more `body elements`_.
2534 ``important`` is analogous to the DocBook "important" element.
2537 Rendered distinctly (inset and/or in a box, etc.), with the
2538 generated title "Important" (or similar).
2546 (`%body.elements;`_)+
2549 The ``important`` element contains only the `common attributes`_:
2550 ids_, names_, dupnames_, source_, and classes_.
2552 :Parameter Entities:
2553 The `%body.elements;`_ parameter entity directly includes
2554 ``important``. The `%structure.model;`_ parameter entity
2555 indirectly includes ``important``.
2561 reStructuredText source::
2565 * Wash behind your ears.
2566 * Clean up your room.
2567 * Back up your data.
2570 Pseudo-XML_ fragment from simple parsing::
2576 Wash behind your ears.
2609 The ``line`` element contains a single line of text, part of a
2617 `Body Subelements`_ (simple)
2620 Only the `line_block`_ element contains ``line``.
2623 ``line`` elements may contain text data plus `inline elements`_.
2626 ``line`` has no direct analogues in common DTDs. It can be
2627 emulated with primitives or type effects.
2641 The ``line`` element contains the `common attributes`_ (ids_,
2642 names_, dupnames_, source_, and classes_), plus `xml:space`_.
2654 The ``line_block`` element contains a sequence of lines and nested
2655 line blocks. Line breaks (implied between elements) and leading
2656 whitespace (indicated by nesting) is significant and must be
2657 preserved. ``line_block`` elements are commonly used for verse and
2658 addresses. See `literal_block`_ for an alternative useful for program
2659 listings and interactive computer sessions.
2666 `Compound Body Elements`_
2669 All elements employing the `%body.elements;`_ or
2670 `%structure.model;`_ parameter entities in their content models
2671 may contain ``line_block``.
2674 ``line_block`` elements may contain line_ elements and nested
2675 ``line_block`` elements.
2678 ``line_block`` is analogous to the DocBook "literallayout" element
2679 and to the HTML "pre" element (with modifications to typeface
2683 Unlike ``literal_block``, ``line_block`` elements are typically
2684 rendered in an ordinary text typeface. It is crucial that leading
2685 whitespace and line breaks are preserved in the rendered form.
2693 (line_ | line_block_)+
2696 The ``line_block`` element contains the `common attributes`_ (ids_,
2697 names_, dupnames_, source_, and classes_), plus `xml:space`_.
2699 :Parameter Entities:
2700 The `%body.elements;`_ parameter entity directly includes
2701 ``line_block``. The `%structure.model;`_ parameter entity
2702 indirectly includes ``line_block``.
2708 reStructuredText uses a directive to indicate a ``line_block``.
2711 Take it away, Eric the Orchestra Leader!
2713 | A one, two, a one two three four
2715 | Half a bee, philosophically,
2716 | must, *ipso facto*, half not be.
2717 | But half the bee has got to be,
2718 | *vis a vis* its entity. D'you see?
2720 | But can a bee be said to be
2721 | or not to be an entire bee,
2722 | when half the bee is not a bee,
2723 | due to some ancient injury?
2727 Pseudo-XML_ fragment from simple parsing::
2730 Take it away, Eric the Orchestra Leader!
2733 A one, two, a one two three four
2736 Half a bee, philosophically,
2744 But half the bee has got to be,
2749 its entity. D'you see?
2752 But can a bee be said to be
2755 or not to be an entire bee,
2758 when half the bee is not a bee,
2761 due to some ancient injury?
2770 The ``list_item`` element is a container for the elements of a list
2778 `Body Subelements`_ (compound)
2781 The bullet_list_ and enumerated_list_ elements contain
2785 ``list_item`` elements may contain `body elements`_.
2788 ``list_item`` is analogous to the HTML "li" element and to the
2789 DocBook "listitem" element.
2792 See bullet_list_ or enumerated_list_.
2800 (`%body.elements;`_)*
2803 The ``list_item`` element contains only the `common attributes`_:
2804 ids_, names_, dupnames_, source_, and classes_.
2810 reStructuredText_ source::
2812 1. Outer list, item 1.
2814 * Inner list, item 1.
2815 * Inner list, item 2.
2817 2. Outer list, item 2.
2819 Pseudo-XML_ fragment from simple parsing::
2821 <enumerated_list enumtype="arabic" prefix="" suffix=".">
2825 <bullet_list bullet="*">
2836 See bullet_list_ or enumerated_list_ for further examples.
2848 The ``literal_block`` element contains a block of text where line
2849 breaks and whitespace are significant and must be preserved.
2850 ``literal_block`` elements are commonly used for program listings and
2851 interactive computer sessions. See `line_block`_ for an alternative
2852 useful for verse and addresses.
2859 `Simple Body Elements`_
2862 All elements employing the `%body.elements;`_ or
2863 `%structure.model;`_ parameter entities in their content models
2864 may contain ``literal_block``.
2867 ``literal_block`` elements may contain text data plus `inline
2871 ``literal_block`` is analogous to the HTML "pre" element and to
2872 the DocBook "programlisting" and "screen" elements.
2875 ``literal_block`` elements are typically rendered in a monospaced
2876 typeface. It is crucial that all whitespace and line breaks are
2877 preserved in the rendered form.
2888 The ``literal_block`` element contains the `common attributes`_
2889 (ids_, names_, dupnames_, source_, and classes_), plus `xml:space`_.
2891 :Parameter Entities:
2892 The `%body.elements;`_ parameter entity directly includes
2893 ``literal_block``. The `%structure.model;`_ parameter entity
2894 indirectly includes ``literal_block``.
2900 reStructuredText source::
2902 Here is a literal block::
2905 text = 'is left as-is'
2906 spaces_and_linebreaks = 'are preserved'
2907 markup_processing = None
2909 Pseudo-XML_ fragment from simple parsing::
2912 Here is a literal block:
2913 <literal_block xml:space="preserve">
2915 text = 'is left as-is'
2916 spaces_and_linebreaks = 'are preserved'
2917 markup_processing = None
2922 The ``math`` element contains text in `LaTeX math format` [#latex-math]_
2923 that is typeset as mathematical notation (inline formula).
2925 If the output format does not support math typesetting, the content is
2935 All elements employing the `%inline.elements;`_ parameter entities in
2936 their content models may contain ``math``.
2939 ``math`` elements may contain text data.
2942 ``math`` is analogous to a MathML "math" element or
2943 the LaTeX (``$ math $``) mode.
2946 Rendered as mathematical notation.
2956 The ``math`` element contains the `common attributes`_
2957 (ids_, names_, dupnames_, source_, and classes_).
2959 .. [#latex-math] For details of the supported mathematical language, see
2960 the `"math" directive`_
2962 .. _"math" directive: rst/directives.html#math
2968 The ``math_block`` element contains a block of text in `LaTeX math
2969 format` [#latex-math]_ that is typeset as mathematical notation
2970 (display formula). The ``math_block`` element is generated during
2971 the initial parse from a `"math" directive`_.
2973 If the output format does not support math typesetting, the content is
2980 `Simple Body Elements`_
2983 All elements employing the `%body.elements;`_ or
2984 `%structure.model;`_ parameter entities in their content models
2985 may contain ``math_block``.
2988 ``math_block`` elements may contain text data.
2991 ``math_block`` is analogous to a LaTeX "equation*" environment or
2992 a MathML "math" element displayed as block-level element.
2995 Rendered in a block as mathematical notation, typically centered or with
3006 The ``math`` element contains the `common attributes`_
3007 (ids_, names_, dupnames_, source_, and classes_).
3013 The ``note`` element is an admonition, a distinctive and
3014 self-contained notice. Also see the other admonition elements
3015 Docutils offers (in alphabetical order): attention_, caution_,
3016 danger_, error_, hint_, important_, tip_, warning_, and the generic
3024 `Compound Body Elements`_
3027 All elements employing the `%body.elements;`_ or
3028 `%structure.model;`_ parameter entities in their content models
3029 may contain ``note``.
3032 ``note`` elements contain one or more `body elements`_.
3035 ``note`` is analogous to the DocBook "note" element.
3038 Rendered distinctly (inset and/or in a box, etc.), with the
3039 generated title "Note" (or similar).
3047 (`%body.elements;`_)+
3050 The ``note`` element contains only the `common attributes`_: ids_,
3051 names_, dupnames_, source_, and classes_.
3053 :Parameter Entities:
3054 The `%body.elements;`_ parameter entity directly includes
3055 ``note``. The `%structure.model;`_ parameter entity indirectly
3062 reStructuredText source::
3064 .. Note:: Admonitions can be handy to break up a
3065 long boring technical document.
3067 Pseudo-XML_ fragment from simple parsing::
3071 Admonitions can be handy to break up a
3072 long boring technical document.
3077 The ``option`` element groups an option string together with zero or
3078 more option argument placeholders. Note that reStructuredText_
3079 currently supports only one argument per option.
3089 Only the option_group_ element contains ``option``.
3092 Each ``option`` element contains one option_string_ and zero or
3093 more option_argument_ elements.
3096 ``option`` has no direct analogues in common DTDs.
3107 (option_string_, option_argument_ \*)
3110 The ``option`` element contains only the `common attributes`_:
3111 ids_, names_, dupnames_, source_, and classes_.
3117 See the examples for the option_list_ element.
3123 The ``option_argument`` element contains placeholder text for option
3134 Only the option_ element contains ``option_argument``.
3137 ``option_argument`` elements contain text data only.
3140 ``option_argument`` has no direct analogues in common DTDs.
3143 The value of the "delimiter" attribute is prefixed to the
3144 ``option_argument``, separating it from its option_string_ or a
3145 preceding ``option_argument``. The ``option_argument`` text is
3146 typically rendered in a monospaced typeface, possibly italicized
3147 or otherwise altered to indicate its placeholder nature.
3158 The ``option_argument`` element contains the `common attributes`_ (ids_,
3159 names_, dupnames_, source_, and classes_), plus delimiter_.
3161 ``delimiter`` contains the text preceding the ``option_argument``:
3162 either the text separating it from the option_string_ (typically
3163 either "=" or " ") or the text between option arguments (typically
3170 See the examples for the option_list_ element.
3176 The ``option_group`` element groups together one or more option_
3177 elements, all synonyms.
3187 Only the option_list_item_ element contains ``option_group``.
3190 ``option_group`` elements contain one or more option_ elements.
3192 ``option_group`` is an empty element and has no children.
3194 Each ``option_group`` element contains one _ and
3198 ``option_group`` has no direct analogues in common DTDs.
3201 Typically option_ elements within an ``option_group`` are joined
3202 together in a comma-separated list.
3210 (option_group_, description_)
3213 The ``option_group`` element contains only the `common attributes`_:
3214 ids_, names_, dupnames_, source_, and classes_.
3220 See the examples for the option_list_ element.
3226 Each ``option_list`` element contains a two-column list of
3227 command-line options and descriptions, documenting a program's
3235 `Compound Body Elements`_
3238 All elements employing the `%body.elements;`_ or
3239 `%structure.model;`_ parameter entities in their content models
3240 may contain ``option_list``.
3243 ``option_list`` elements contain one or more option_list_item_
3247 ``option_list`` has no direct analogues in common DTDs. It can be
3248 emulated with primitives such as tables.
3251 An ``option_list`` is typically rendered as a two-column list,
3252 where the first column contains option strings and arguments, and
3253 the second column contains descriptions.
3261 (option_list_item_ +)
3264 The ``option_list`` element contains only the `common attributes`_:
3265 ids_, names_, dupnames_, source_, and classes_.
3267 :Parameter Entities:
3268 The `%body.elements;`_ parameter entity directly includes
3269 ``option_list``. The `%structure.model;`_ parameter entity
3270 indirectly includes ``option_list``.
3276 reStructuredText_ source::
3278 -a command-line option "a"
3279 -1 file, --one=file, --two file
3280 Multiple options with arguments.
3282 Pseudo-XML_ fragment from simple parsing::
3292 command-line option "a"
3298 <option_argument delimiter=" ">
3303 <option_argument delimiter="=">
3308 <option_argument delimiter=" ">
3312 Multiple options with arguments.
3315 ``option_list_item``
3316 ====================
3318 The ``option_list_item`` element is a container for a pair of
3319 option_group_ and description_ elements.
3329 Only the option_list_ element contains ``option_list_item``.
3332 Each ``option_list_item`` element contains one option_group_ and
3333 one description_ element.
3336 ``option_list_item`` has no direct analogues in common DTDs.
3347 (option_group_, description_)
3350 The ``option_list_item`` element contains only the `common attributes`_:
3351 ids_, names_, dupnames_, source_, and classes_.
3357 See the examples for the option_list_ element.
3363 The ``option_string`` element contains the text of a command-line
3374 Only the option_ element contains ``option_string``.
3377 ``option_string`` elements contain text data only.
3380 ``option_string`` has no direct analogues in common DTDs.
3383 The ``option_string`` text is typically rendered in a monospaced
3395 The ``option_string`` element contains only the `common attributes`_:
3396 ids_, names_, dupnames_, source_, and classes_.
3402 See the examples for the option_list_ element.
3408 The ``organization`` element contains the name of document author's
3409 organization, or the organization responsible for the document.
3416 `Bibliographic Elements`_
3419 Only the docinfo_ element contains ``organization``.
3422 ``organization`` elements may contain text data plus `inline
3426 ``organization`` is analogous to the DocBook "orgname",
3427 "corpname", or "publishername" elements.
3441 The ``organization`` element contains only the `common attributes`_:
3442 ids_, names_, dupnames_, source_, and classes_.
3444 :Parameter Entities:
3445 The `%bibliographic.elements;`_ parameter entity directly includes
3452 reStructuredText_ source::
3457 :Organization: Humankind
3459 Complete pseudo-XML_ result after parsing and applying transforms::
3461 <document ids="document-title" names="document title">
3468 See docinfo_ for a more complete example, including processing
3475 The ``paragraph`` element contains the text and inline elements of a
3476 single paragraph, a fundamental building block of documents.
3483 `Simple Body Elements`_
3486 All elements employing the `%body.elements;`_ or
3487 `%structure.model;`_ parameter entities in their content models
3488 may contain ``paragraph``.
3491 ``paragraph`` elements may contain text data plus `inline
3495 ``paragraph`` is analogous to the HTML "p" element and to the
3496 DocBook "para" elements.
3507 The ``paragraph`` element contains only the `common attributes`_:
3508 ids_, names_, dupnames_, source_, and classes_.
3510 :Parameter Entities:
3511 The `%body.elements;`_ parameter entity directly includes
3512 ``paragraph``. The `%structure.model;`_ parameter entity
3513 indirectly includes ``paragraph``.
3519 reStructuredText_ source::
3523 Pseudo-XML_ fragment from simple parsing::
3556 The ``revision`` element contains the revision number of the document.
3557 It can be used alone or in conjunction with version_.
3564 `Bibliographic Elements`_
3567 Only the docinfo_ element contains ``revision``.
3570 ``revision`` elements may contain text data plus `inline
3574 ``revision`` is analogous to but simpler than the DocBook
3575 "revision" element. It closely matches the DocBook "revnumber"
3576 element, but in a simpler context.
3579 Often used with the RCS/CVS keyword "Revision". See docinfo_.
3590 The ``revision`` element contains only the `common attributes`_:
3591 ids_, names_, dupnames_, source_, and classes_.
3593 :Parameter Entities:
3594 The `%bibliographic.elements;`_ parameter entity directly includes
3601 reStructuredText_ source::
3609 Complete pseudo-XML_ result after parsing and applying transforms::
3611 <document ids="document-title" names="document title">
3620 See docinfo_ for a more complete example, including processing
3633 rubric n. 1. a title, heading, or the like, in a manuscript,
3634 book, statute, etc., written or printed in red or otherwise
3635 distinguished from the rest of the text. ...
3637 -- Random House Webster's College Dictionary, 1991
3639 A rubric is like an informal heading that doesn't correspond to the
3640 document's structure.
3648 The ``section`` element is the main unit of hierarchy for Docutils
3649 documents. Docutils ``section`` elements are a recursive structure; a
3650 ``section`` may contain other ``section`` elements, without limit.
3651 Paragraphs and other body elements may occur before a ``section``, but
3659 `Structural Elements`_
3662 The following elements may contain ``section``: document_,
3666 ``section`` elements begin with a title_, and may contain `body
3667 elements`_ as well as transition_, topic_, and sidebar_ elements.
3670 ``section`` is analogous to the recursive "section" elements in
3680 `%structure.model;`_)
3682 See the `%structure.model;`_ parameter entity for details of the body
3686 The ``section`` element contains only the `common attributes`_:
3687 ids_, names_, dupnames_, source_, and classes_.
3689 :Parameter Entities:
3690 The `%section.elements;`_ parameter entity directly includes
3691 ``section``. The `%structure.model;`_ parameter entity indirectly
3692 includes ``section``.
3698 reStructuredText_ source::
3716 Complete pseudo-XML_ result after parsing::
3719 <section ids="title-1" names="title 1">
3724 <section ids="title-2" names="title 2">
3729 <section ids="title-3" names="title 3">
3734 <section ids="title-4" names="title 4">
3744 Sidebars are like miniature, parallel documents that occur inside
3745 other documents, providing related or reference material. A
3746 ``sidebar`` is typically offset by a border and "floats" to the side
3747 of the page; the document's main text may flow around it. Sidebars
3748 can also be likened to super-footnotes; their content is outside of
3749 the flow of the document's main text.
3751 The ``sidebar`` element is a nonrecursive section_-like construct
3752 which may occur at the top level of a section_ wherever a body element
3753 (list, table, etc.) is allowed. In other words, ``sidebar`` elements
3754 cannot nest inside body elements, so you can't have a ``sidebar``
3755 inside a ``table`` or a ``list``, or inside another ``sidebar`` (or
3763 `Structural Elements`_
3766 The following elements may contain ``sidebar``: document_,
3770 ``sidebar`` elements begin with optional title_ and subtitle_
3771 and contain `body elements`_ and topic_ elements.
3774 ``sidebar`` is analogous to the DocBook "sidebar" element.
3777 A ``sidebar`` element should be set off from the rest of the
3778 document somehow, typically with a border. Sidebars typically
3779 "float" to the side of the page and the document's main text flows
3788 (title_, subtitle_?,
3789 (`%body.elements;`_ | topic_)+)
3792 The ``sidebar`` element contains only the `common attributes`_:
3793 ids_, names_, dupnames_, source_, and classes_.
3795 :Parameter Entities:
3796 The `%structure.model;`_ parameter entity directly includes
3803 The `"sidebar" directive`_ is used to create a ``sidebar`` element.
3804 reStructuredText_ source::
3806 .. sidebar:: Optional Title
3807 :subtitle: If Desired
3811 Pseudo-XML_ fragment from simple parsing::
3821 .. _"sidebar" directive: rst/directives.html#sidebar
3827 The ``status`` element contains a status statement for the document,
3828 such as "Draft", "Final", "Work In Progress", etc.
3835 `Bibliographic Elements`_
3838 Only the docinfo_ element contains ``status``.
3841 ``status`` elements may contain text data plus `inline elements`_.
3844 ``status`` is analogous to the DocBook "status" element.
3858 The ``status`` element contains only the `common attributes`_:
3859 ids_, names_, dupnames_, source_, and classes_.
3861 :Parameter Entities:
3862 The `%bibliographic.elements;`_ parameter entity directly includes
3869 reStructuredText_ source::
3874 :Status: Work In Progress
3876 Complete pseudo-XML_ result after parsing and applying transforms::
3878 <document ids="document-title" names="document title">
3885 See docinfo_ for a more complete example, including processing
3901 ``substitution_definition``
3902 ===========================
3907 ``substitution_reference``
3908 ==========================
3916 The ``subtitle`` element stores the subtitle of a document_.
3923 `Structural Subelements`_
3926 The document_ and sidebar_ elements may contain ``subtitle``.
3929 ``subtitle`` elements may contain text data plus `inline
3933 ``subtitle`` is analogous to HTML header elements ("h2" etc.) and
3934 to the DocBook "subtitle" element.
3937 A document's subtitle is usually rendered smaller than its title_.
3948 The ``subtitle`` element contains only the `common attributes`_:
3949 ids_, names_, dupnames_, source_, and classes_.
3955 reStructuredText_ source::
3966 Complete pseudo-XML_ result after parsing and applying transforms::
3968 <document ids="title" names="title">
3971 <subtitle ids="subtitle" names="subtitle">
3976 Note how two section levels have collapsed, promoting their titles to
3977 become the document's title and subtitle. Since there is only one
3978 structural element (document), the subsection's ``ids`` and ``names``
3979 attributes are stored in the ``subtitle`` element.
3997 Docutils tables are based on the Exchange subset of the CALS-table model
3998 (OASIS Technical Memorandum 9901:1999 "XML Exchange Table Model DTD",
3999 http://www.oasis-open.org/html/tm9901.htm).
4019 The ``term`` element contains a word or phrase being defined in a
4027 `Body Subelements`_ (simple)
4030 Only the definition_list_item_ element contains ``term``.
4033 ``term`` elements may contain text data plus `inline elements`_.
4036 ``term`` is analogous to the HTML "dt" element and to the DocBook
4040 See definition_list_item_.
4051 The ``term`` element contains only the `common attributes`_:
4052 ids_, names_, dupnames_, source_, and classes_.
4058 See the examples for the definition_list_, definition_list_item_, and
4059 classifier_ elements.
4077 The ``tip`` element is an admonition, a distinctive and self-contained
4078 notice. Also see the other admonition elements Docutils offers (in
4079 alphabetical order): attention_, caution_, danger_, error_, hint_,
4080 important_, note_, warning_, and the generic admonition_.
4087 `Compound Body Elements`_
4090 All elements employing the `%body.elements;`_ or
4091 `%structure.model;`_ parameter entities in their content models
4092 may contain ``tip``.
4095 ``tip`` elements contain one or more `body elements`_.
4098 ``tip`` is analogous to the DocBook "tip" element.
4101 Rendered distinctly (inset and/or in a box, etc.), with the
4102 generated title "Tip" (or similar).
4110 (`%body.elements;`_)+
4113 The ``tip`` element contains only the `common attributes`_: ids_,
4114 names_, dupnames_, source_, and classes_.
4116 :Parameter Entities:
4117 The `%body.elements;`_ parameter entity directly includes ``tip``.
4118 The `%structure.model;`_ parameter entity indirectly includes
4125 reStructuredText source::
4127 .. Tip:: 15% if the service is good.
4129 Pseudo-XML_ fragment from simple parsing::
4133 15% if the service is good.
4141 The ``title`` element stores the title of a document_, section_,
4142 topic_, sidebar_, or generic admonition_.
4149 `Structural Subelements`_
4152 The following elements may contain ``title``: document_, section_,
4153 topic_, sidebar_, admonition_
4156 ``title`` elements may contain text data plus `inline elements`_.
4159 ``title`` is analogous to HTML "title" and header ("h1" etc.)
4160 elements, and to the DocBook "title" element.
4171 The ``title`` element contains the `common attributes`_ (ids_,
4172 names_, dupnames_, source_, and classes_), plus refid_ and auto_.
4174 ``refid`` is used as a backlink to a table of contents entry.
4176 ``auto`` is used to indicate (with value "1") that the ``title``
4177 has been numbered automatically.
4183 reStructuredText_ source::
4190 Pseudo-XML_ fragment from simple parsing::
4192 <section ids="a-title" names="a title">
4208 The ``topic`` element is a nonrecursive section_-like construct which
4209 may occur at the top level of a section_ wherever a body element
4210 (list, table, etc.) is allowed. In other words, ``topic`` elements
4211 cannot nest inside body elements, so you can't have a ``topic`` inside
4212 a ``table`` or a ``list``, or inside another ``topic``.
4219 `Structural Elements`_
4222 The following elements may contain ``topic``: document_, section_,
4226 ``topic`` elements begin with a title_ and may contain `body
4230 ``topic`` is analogous to the DocBook "simplesect" element.
4233 A ``topic`` element should be set off from the rest of the
4234 document somehow, such as with indentation or a border.
4243 (`%body.elements;`_)+)
4246 The ``topic`` element contains only the `common attributes`_:
4247 ids_, names_, dupnames_, source_, and classes_.
4249 :Parameter Entities:
4250 The `%structure.model;`_ parameter entity directly includes
4257 The `"topic" directive`_ is used to create a ``topic`` element.
4258 reStructuredText_ source::
4264 Pseudo-XML_ fragment from simple parsing::
4272 .. _"topic" directive: rst/directives.html#topic
4278 The ``transition`` element is commonly seen in novels and short
4279 fiction, as a gap spanning one or more lines, with or without a type
4280 ornament such as a row of asterisks. Transitions separate body
4281 elements and sections, dividing a section into untitled divisions. A
4282 transition may not begin or end a section [#]_ or document, nor may
4283 two transitions be immediately adjacent.
4285 See `Doctree Representation of Transitions`__ in `A Record of
4286 reStructuredText Syntax Alternatives`__.
4288 .. [#] In reStructuredText markup, a transition may appear to fall at
4289 the end of a section immediately before another section. A
4290 transform recognizes this case and moves the transition so it
4291 separates the sections.
4293 __ ../dev/rst/alternatives.html#doctree-representation-of-transitions
4294 __ ../dev/rst/alternatives.html
4301 `Structural Subelements`_
4304 The following elements may contain ``transition``: document_,
4308 ``transition`` is an empty element and has no children.
4311 ``transition`` is analogous to the HTML "hr" element.
4314 The ``transition`` element is typically rendered as vertical
4315 whitespace (more than that separating paragraphs), with or without
4316 a horizontal line or row of asterisks. In novels, transitions are
4317 often represented as a row of three well-spaced asterisks with
4318 vertical space above and below.
4328 The ``transition`` element has no content; it is a "point element".
4331 The ``transition`` element contains only the `common attributes`_:
4332 ids_, names_, dupnames_, source_, and classes_.
4334 :Parameter Entities:
4335 The `%structure.model;`_ parameter entity directly includes
4342 reStructuredText_ source::
4350 Complete pseudo-XML_ result after parsing::
4363 The ``version`` element contains the version number of the document.
4364 It can be used alone or in conjunction with revision_.
4371 `Bibliographic Elements`_
4374 Only the docinfo_ element contains ``version``.
4377 ``version`` elements may contain text data plus `inline
4381 ``version`` may be considered analogous to the DocBook "revision",
4382 "revnumber", or "biblioid" elements.
4385 Sometimes used with the RCS/CVS keyword "Revision". See docinfo_
4397 The ``version`` element contains only the `common attributes`_:
4398 ids_, names_, dupnames_, source_, and classes_.
4400 :Parameter Entities:
4401 The `%bibliographic.elements;`_ parameter entity directly includes
4408 reStructuredText_ source::
4415 Complete pseudo-XML_ result after parsing and applying transforms::
4417 <document ids="document-title" names="document title">
4424 See docinfo_ for a more complete example, including processing
4431 The ``warning`` element is an admonition, a distinctive and
4432 self-contained notice. Also see the other admonition elements
4433 Docutils offers (in alphabetical order): attention_, caution_,
4434 danger_, error_, hint_, important_, note_, tip_.
4441 `Compound Body Elements`_
4444 All elements employing the `%body.elements;`_ or
4445 `%structure.model;`_ parameter entities in their content models
4446 may contain ``warning``.
4449 ``warning`` elements contain one or more `body elements`_.
4452 ``warning`` is analogous to the DocBook "warning" element.
4455 Rendered distinctly (inset and/or in a box, etc.), with the
4456 generated title "Warning" (or similar).
4464 (`%body.elements;`_)+
4467 The ``warning`` element contains only the `common attributes`_:
4468 ids_, names_, dupnames_, source_, and classes_.
4470 :Parameter Entities:
4471 The `%body.elements;`_ parameter entity directly includes
4472 ``warning``. The `%structure.model;`_ parameter entity indirectly
4473 includes ``warning``.
4479 reStructuredText source::
4481 .. WARNING:: Reader discretion is strongly advised.
4483 Pseudo-XML_ fragment from simple parsing::
4487 Reader discretion is strongly advised.
4496 .. contents:: :local:
4499 Standard attribute types
4500 ========================
4502 Attribute types defined in the `attribute types`__ section of the
4503 `XML 1.0 specification`_:
4506 Character data. CDATA attributes may contain arbitrary text.
4509 A "name token". One or more of letters, digits, ".", "-", and
4513 One or more space-separated NMTOKEN values.
4516 The attribute value may be one of a specified list of values.
4518 Docutils uses `custom attribute types`_ instead of the ID, IDREF, and IDREFS
4519 standard types, because it does not adhere to the `One ID per Element Type`_
4520 validity constraint.
4522 __ `XML attribute types`_
4525 Custom attribute types
4526 ======================
4528 The Docutils DTD defines `parameter entities`_ that resolve to standard
4529 attribute types to highlight specific attribute value constraints.
4532 Boolean: no if zero ("0"), yes if any other value.
4533 Resolves to ``NMTOKEN``.
4535 Used in the `anonymous`_ and `stub`_ attributes.
4538 The attribute value must be a number. Resolves to ``NMTOKEN``.
4540 Used in the `start`_ and `scale`_ attributes.
4542 .. also ltrim, rtrim
4545 A number which may be immediately followed by a unit or percent sign.
4548 Used in the `height`_ and `width`_ attributes.
4551 A space-separated list of `class names` [#classname]_. Resolves to NMTOKEN.
4553 Used in the `classes`_ attribute.
4556 A normalized_ `reference name`_. Resolves to CDATA (in contrast to
4557 NMTOKENS, `reference names`_ may consist of any text).
4559 Used in the `refname`_ attribute.
4562 A space-separated list of `reference names`_. Resolves to CDATA.
4564 `Backslash escaping`_ is used for space characters inside a `reference
4567 Used in the `names`_ and `dupnames`_ attributes.
4570 A space-separated list of unique `identifier keys` [#identifier]_.
4571 Resolves to NMTOKENS (the XML `standard attribute types`_ do not provide
4574 Used in the `ids`_ attribute.
4577 A reference to an `identifier key`_.
4578 Resolves to NMTOKEN (Docutils identifier keys do not use the ID standard
4579 type as required by the `IDREF Validity constraint`_).
4581 Used in the `refid`_ attribute.
4584 A list of references to element identifiers.
4585 Resolves to NMTOKENS.
4587 Used in the `backrefs`_ attribute.
4591 .. [#classname] `Class names` define sub-classes of existing elements.
4593 In reStructuredText, custom `class names` can be specified using
4594 the `"class" directive`_, a directive's `:class: option`_, or
4595 `custom interpreted text roles`_.
4596 Docutils normalizes them to conform to both, HTML4.1 and CSS1.0 `name`
4597 requirements (the regular expression ``[a-z](-?[a-z0-9]+)*``) via the
4598 `identifier normalization`_.
4602 .. _identifier keys:
4604 .. [#identifier] `Identifier keys` are used for cross references in
4605 generated documents. Therefore, they must comply with restrictions in the
4606 respective output formats (HTML4.1__, HTML5__, `polyglot HTML`__,
4607 LaTeX__, ODT__, troff (manpage), XML__).
4609 Identifier keys cannot be specified directly in reStructuredText.
4610 Docutils generates them by applying the `identifier normalization`_ to
4611 `reference names`_ or from the auto_id_prefix_, prepending the id_prefix_
4612 and potentially appending numbers for disambiguation.
4614 __ http://www.w3.org/TR/html401/types.html#type-name
4615 __ https://www.w3.org/TR/html50/dom.html#the-id-attribute
4616 __ https://www.w3.org/TR/html-polyglot/#id-attribute
4617 __ https://tex.stackexchange.com/questions/18311/what-are-the-valid-names-as-labels
4618 __ https://help.libreoffice.org/6.3/en-US/text/swriter/01/04040000.html?DbPAR=WRITER#bm_id4974211
4619 __ https://www.w3.org/TR/REC-xml/#id
4622 .. _XML 1.0 specification: https://www.w3.org/TR/REC-xml
4623 .. _XML attribute types: https://www.w3.org/TR/REC-xml/#sec-attribute-types
4624 .. _One ID per Element Type: https://www.w3.org/TR/REC-xml/#one-id-per-el
4625 .. .. _ID attribute type: https://www.w3.org/TR/REC-xml/#id
4626 .. _parameter entities: https://www.w3.org/TR/REC-xml/#dt-PE
4627 .. _IDREF Validity constraint: https://www.w3.org/TR/REC-xml/#idref
4629 .. _reference names:
4630 .. _reference name: rst/restructuredtext.html#reference-names
4631 .. _backslash escaping: rst/restructuredtext.html#escaping-mechanism
4632 .. _id_prefix: ../user/config.html#id-prefix
4633 .. _auto_id_prefix: ../user/config.html#auto-id-prefix
4634 .. _identifier normalization:
4635 rst/directives.html#identifier-normalization
4636 .. _`:class: option`: rst/directives.html#class-option
4637 .. _custom interpreted text roles:
4638 rst/directives.html#custom-interpreted-text-roles
4641 ---------------------
4643 ---------------------
4645 .. contents:: :local:
4648 _`Common Attributes`: Through the `%basic.atts;`_ parameter entity,
4649 all elements contain the following attributes: ids_, names_ or dupnames_,
4650 source_, and classes_.
4656 Attribute type: `yesorno`_. Default value: none (implies no).
4658 The ``anonymous`` attribute is used for unnamed hyperlinks in the
4659 target_ and reference_ elements (via the `%anonymous.att;`_ parameter
4666 Attribute type: `CDATA`_. Default value: none.
4668 The ``auto`` attribute is used to indicate automatically-numbered
4669 footnote_, footnote_reference_ and title_ elements (via the
4670 `%auto.att;`_ parameter entity).
4676 Attribute type: `idrefs.type`_. Default value: none.
4678 The ``backrefs`` attribute contains a space-separated list of identifier_
4679 references, used for backlinks from footnote_, citation_, and
4680 system_message_ elements (via the `%backrefs.att;`_ parameter entity).
4686 Attribute type: `CDATA`_. Default value: none.
4688 The ``bullet`` attribute is used in the bullet_list_ element.
4694 Attribute type: `classnames.type`_. Default value: none.
4696 The ``classes`` attribute is a space separated list containing zero or more
4699 The purpose of the attribute is to indicate an "is-a" variant relationship,
4700 to allow an extensible way of defining sub-classes of existing elements. It
4701 can be used to carry context forward between a Docutils Reader and Writer,
4702 when a custom structure is reduced to a standardized document tree. One
4703 common use is in conjunction with stylesheets, to add selection criteria.
4704 It should not be used to carry formatting instructions or arbitrary content.
4706 The ``classes`` attribute's contents should be ignorable. Writers that
4707 are not familiar with the variant expressed should be able to ignore
4710 ``classes`` is one of the `common attributes`_, shared by all Docutils
4713 .. _"class" directive: rst/directives.html#class
4719 Attribute type: `CDATA`_. Default value: none.
4721 The ``delimiter`` attribute is used in the option_argument_ element.
4727 Attribute type: `refnames.type`_. Default value: none.
4729 The ``dupnames`` attribute replaces the `names`_ attribute
4730 when there has been a naming conflict.
4731 ``dupnames`` is one of the `common attributes`_, shared by all
4738 Attribute type: EnumeratedType_, one of "arabic", "loweralpha",
4739 "upperalpha", "lowerroman", or "upperroman". Default value: none.
4741 The ``enumtype`` attribute is used in the enumerated_list_ element.
4747 Attribute type: measure_. Default value: none.
4749 The ``height`` attribute is used in the image_ element.
4755 Attribute type: `ids.type`_. Default value: none.
4757 The ``ids`` attribute is a space separated list containing one or more
4758 unique `identifier keys`_, typically assigned by the system.
4760 ``ids`` is one of the `common attributes`_, shared by all Docutils
4764 * Use 'id' for primary identifier key?
4765 * Keep additional keys in `ids`
4766 or in the preceding target elements?
4772 Attribute type: `refnames.type`_. Default value: none.
4774 The ``names`` attribute is a space-separated list containing
4775 `normalized`_ `reference names`_ of an element. Whitespace inside a
4776 name is backslash escaped.
4777 Each name in the list must be unique; if there are name conflicts
4778 (two or more elements want to the same name), the contents will be
4779 transferred to the `dupnames`_ attribute on the duplicate elements.
4780 An element may have at most one of the ``names`` or ``dupnames``
4781 attributes, but not both.
4783 `Reference names`_ are identifiers assigned in the markup. They
4784 originate from `internal hyperlink targets`_, a directive's `name
4785 option`_, or the element's title or content and are used for
4786 internal cross-references (cf. refname_).
4788 ``names`` is one of the `common attributes`_, shared by all
4792 rst/restructuredtext.html#normalized-reference-names
4793 .. _internal hyperlink targets:
4794 rst/restructuredtext.html#internal-hyperlink-targets
4795 .. _name option: rst/directives.html#name
4801 Attribute type: `CDATA`_. Default value: none.
4803 The ``prefix`` attribute is used in the enumerated_list_ element.
4809 Attribute type: `idref.type`_. Default value: none.
4811 The ``refid`` attribute contains a reference to an `identifier key`_
4813 ``refid`` is used by the target_, reference_, footnote_reference_,
4814 citation_reference_, title_ and problematic_ elements (via the
4815 `%refid.att;`_ and `%reference.atts;`_ parameter entities).
4821 Attribute type: `refname.type`_. Default value: none.
4823 The ``refname`` attribute contains a reference to one of the
4824 `reference names`_ in the `names`_ attribute of another element. On
4825 a `target`_ element, ``refname`` indicates an `indirect target`_ which
4826 may resolve to either an internal or external reference. Docutils
4827 "transforms_" replace the ``refname`` attribute with a refid_ pointing
4828 to the same element.
4830 ``refname`` is used by the target_, reference_, footnote_reference_,
4831 citation_reference_, and substitution_reference_ elements (via the
4832 `%refname.att;`_ and `%reference.atts;`_ parameter entities).
4834 .. _indirect target: rst/restructuredtext.html#indirect-hyperlink-targets
4835 .. _transforms: transforms.html
4841 Attribute type: `CDATA`_. Default value: none.
4843 The ``refuri`` attribute contains an external reference to a URI/URL.
4844 It is used by the target_, reference_, footnote_reference_, and
4845 citation_reference_ elements (via the `%reference.atts;`_ parameter
4852 Attribute type: number_. Default value: none.
4854 The ``scale`` attribute is used in the image_ element.
4860 Attribute type: `CDATA`_. Default value: none.
4862 The ``source`` attribute is used to store the path or URL to the
4863 source text that was used to produce the document tree. It is one of
4864 the `common attributes`_, shared by all Docutils elements.
4870 Attribute type: `number`_. Default value: none.
4872 The ``start`` attribute is used in the enumerated_list_ element.
4878 Attribute type: `yesorno`_. Default value: none.
4880 The ``stub`` attribute is used in the colspec_ element.
4886 Attribute type: `CDATA`_. Default value: none.
4888 The ``suffix`` attribute is used in the enumerated_list_ element.
4894 Attribute type: measure_. Default value: none.
4896 The ``width`` attribute is used in the image_ element.
4902 `Attribute type`: `EnumeratedType`_, one of "default" or "preserve".
4903 Default value: "preserve" (fixed).
4905 The ``xml:space`` attribute is a standard XML attribute for
4906 whitespace-preserving elements. It is used by the literal_block_,
4907 line_block_, doctest_block_, comment_, and raw_ elements (via the
4908 `%fixedspace.att;`_ parameter entity). It is a fixed attribute, meant
4909 to communicate to an XML parser that the element contains significant
4910 whitespace. The attribute value should not be set in a document
4914 .. _title (attribute):
4919 Attribute type: `CDATA`_. Default value: none.
4921 The ``title`` attribute stores the title metadata of a document. This
4922 title is typically not part of the rendered document. It may for
4923 example be used in HTML's ``title`` element.
4926 ----------------------------
4927 Parameter Entity Reference
4928 ----------------------------
4930 .. contents:: :local:
4933 Parameter entities are used to simplify the DTD (to share definitions
4934 and reduce duplication) and to allow the DTD to be customized by
4935 wrapper DTDs (external client DTDs that use or import the Docutils
4936 DTD). Parameter entities may be overridden by wrapper DTDs, replacing
4937 the definitions below with custom definitions. Parameter entities
4938 whose names begin with "additional" are meant to allow easy extension
4945 The ``%anonymous.att;`` parameter entity contains the anonymous_
4946 attribute, used for unnamed hyperlinks.
4952 anonymous_ %yesorno; #IMPLIED
4954 The reference_ and target_ elements directly employ the
4955 ``%anonymous.att;`` parameter entity in their attribute lists.
4961 The ``%auto.att;`` parameter entity contains the auto_ attribute, used
4962 to indicate an automatically-numbered footnote or title.
4968 auto_ CDATA #IMPLIED
4970 The footnote_, footnote_reference_, and title_ elements directly
4971 employ the ``%auto.att;`` parameter entity in their attribute lists.
4977 The ``%backrefs.att;`` parameter entity contains the backrefs_
4978 attribute, a space-separated list of id references, for backlinks.
4984 backrefs_ %idrefs.type; #IMPLIED
4986 The citation_, footnote_, and system_message_ elements directly employ
4987 the ``%backrefs.att;`` parameter entity in their attribute lists.
4993 The ``%basic.atts;`` parameter entity lists attributes common to all
4994 Docutils elements. See `Common Attributes`_.
5000 ids_ NMTOKENS #IMPLIED
5001 names_ CDATA #IMPLIED
5002 dupnames_ CDATA #IMPLIED
5003 source_ CDATA #IMPLIED
5004 classes_ NMTOKENS #IMPLIED
5005 %additional.basic.atts;
5007 The ``%additional.basic.atts;`` parameter entity can be used by
5008 wrapper DTDs to extend ``%basic.atts;``.
5011 ``%bibliographic.elements;``
5012 ============================
5014 The ``%bibliographic.elements;`` parameter entity contains an OR-list of all
5015 `bibliographic elements`_.
5021 author_ | authors_ | organization_ | contact_ | address_
5022 | version_ | revision_ | status_ | date_ | copyright_
5024 %additional.bibliographic.elements;
5026 The ``%additional.bibliographic.elements;`` parameter entity can be used by
5027 wrapper DTDs to extend ``%bibliographic.elements;``.
5029 Only the docinfo_ element directly employs the
5030 ``%bibliographic.elements;`` parameter entity in its content model.
5036 The ``%body.elements;`` parameter entity contains an OR-list of all
5037 `body elements`_. ``%body.elements;`` is itself contained within the
5038 `%structure.model;`_ parameter entity.
5044 admonition_ | attention_ | block_quote_ | bullet_list_ | caution_
5045 | citation_ | compound_ | comment_ | container_ | danger_ |
5046 definition_list_ | doctest_block_ | enumerated_list_ | error_ |
5047 field_list_ | figure_ | footnote_ | hint_ | image_ | important_
5048 | line_block_ | literal_block_ | note_ | option_list_ |
5049 paragraph_ | pending_ | raw_ reference_ | rubric_ |
5050 substitution_definition_ | system_message_ | table_ | target_ |
5051 tip_ | warning_ %additional.body.elements;
5053 The ``%additional.body.elements;`` parameter entity can be used by
5054 wrapper DTDs to extend ``%body.elements;``.
5056 The ``%body.elements;`` parameter entity is directly employed in the
5057 content models of the following elements: admonition_, attention_,
5058 block_quote_, caution_, citation_, compound_, danger_, definition_,
5059 description_, entry_, error_, field_body_, footer_, footnote_,
5060 header_, hint_, important_, legend_, list_item_, note_, sidebar_,
5061 system_message_, tip_, topic_, warning_
5063 Via `%structure.model;`_, the ``%body.elements;`` parameter entity is
5064 indirectly employed in the content models of the document_ and
5068 ``%fixedspace.att;``
5069 ====================
5071 The ``%fixedspace.att;`` parameter entity contains the `xml:space`_
5072 attribute, a standard XML attribute for whitespace-preserving
5079 `xml:space`_ (default | preserve) #FIXED 'preserve'
5081 The ``%fixedspace.att;`` parameter entity is directly employed in the
5082 attribute lists of the following elements: address_, comment_,
5083 doctest_block_, line_block_, literal_block_, raw_
5086 ``%inline.elements;``
5087 =====================
5089 The ``%inline.elements;`` parameter entity contains an OR-list of all
5096 abbreviation_ | acronym_ | citation_reference_ | emphasis_ |
5097 footnote_reference_ | generated_ | image_ | inline_ | literal_ |
5098 problematic_ | raw_ | reference_ | strong_ | substitution_reference_ |
5099 subscript_ | superscript_ | target_ | title_reference_
5100 %additional.inline.elements;
5102 The ``%additional.inline.elements;`` parameter entity can be used by
5103 wrapper DTDs to extend ``%inline.elements;``.
5105 Via `%text.model;`_, the ``%inline.elements;`` parameter entity is
5106 indirectly employed in the content models of the following elements:
5107 abbreviation_, acronym_, address_, attribution_, author_, caption_,
5108 classifier_, contact_, copyright_, date_, doctest_block_, emphasis_,
5109 generated_, inline_, line_block_, literal_block_, math_, math_block_,
5111 paragraph_, problematic_, raw_, reference_, revision_, rubric_,
5112 status_, strong_, subscript_, substitution_definition_,
5113 substitution_reference_, subtitle_, superscript_, target_, term_,
5114 title_, title_reference_, version_
5117 ``%reference.atts;``
5118 ====================
5120 The ``%reference.atts;`` parameter entity groups together the refuri_,
5121 refid_, and refname_ attributes.
5130 %additional.reference.atts;
5132 The ``%additional.reference.atts;`` parameter entity can be used by
5133 wrapper DTDs to extend ``%additional.reference.atts;``.
5135 The citation_reference_, footnote_reference_, reference_, and target_
5136 elements directly employ the ``%reference.att;`` parameter entity in
5137 their attribute lists.
5143 The ``%refid.att;`` parameter entity contains the refid_ attribute, an
5144 internal reference to the `ids`_ attribute of another element.
5150 refid_ %idref.type; #IMPLIED
5152 The title_ and problematic_ elements directly employ the
5153 ``%refid.att;`` parameter entity in their attribute lists.
5155 Via `%reference.atts;`_, the ``%refid.att;`` parameter entity is
5156 indirectly employed in the attribute lists of the citation_reference_,
5157 footnote_reference_, reference_, and target_ elements.
5163 The ``%refname.att;`` parameter entity contains the refname_
5164 attribute, an internal reference to the `names`_ attribute of another
5165 element. On a `target`_ element, ``refname`` indicates an indirect
5166 target which may resolve to either an internal or external
5173 refname_ %refname.type; #IMPLIED
5175 The substitution_reference_ element directly employs the
5176 ``%refname.att;`` parameter entity in its attribute list.
5178 Via `%reference.atts;`_, the ``%refname.att;`` parameter entity is
5179 indirectly employed in the attribute lists of the citation_reference_,
5180 footnote_reference_, reference_, and target_ elements.
5186 The ``%refuri.att;`` parameter entity contains the refuri_ attribute,
5187 an external reference to a URI/URL.
5193 refuri_ CDATA #IMPLIED
5195 Via `%reference.atts;`_, the ``%refuri.att;`` parameter entity is
5196 indirectly employed in the attribute lists of the citation_reference_,
5197 footnote_reference_, reference_, and target_ elements.
5200 ``%section.elements;``
5201 ======================
5203 The ``%section.elements;`` parameter entity contains an OR-list of all
5204 section_-equivalent elements. ``%section.elements;`` is itself
5205 contained within the `%structure.model;`_ parameter entity.
5212 %additional.section.elements;
5214 The ``%additional.section.elements;`` parameter entity can be used
5215 by wrapper DTDs to extend ``%section.elements;``.
5217 Via `%structure.model;`_, the ``%section.elements;`` parameter entity
5218 is indirectly employed in the content models of the document_ and
5222 ``%structure.model;``
5223 =====================
5225 The ``%structure.model;`` parameter entity encapsulates the
5226 hierarchical structure of a document and of its constituent parts.
5227 See the discussion of the `element hierarchy`_ above.
5233 ( ( (`%body.elements;`_ | topic_ | sidebar_)+, transition_? )*,
5234 ( (`%section.elements;`_), (transition_?, (`%section.elements;`_) )* )? )
5236 Each document_ or section_ contains zero or more body elements,
5237 topics, and/or sidebars, optionally interspersed with single
5238 transitions, followed by zero or more sections (whose contents are
5239 recursively the same as this model) optionally interspersed with
5242 The following restrictions are imposed by this model:
5244 * Transitions must be separated by other elements (body elements,
5245 sections, etc.). In other words, a transition may not be
5246 immediately adjacent to another transition.
5248 * A transition may not occur at the beginning of a document or
5251 .. The following is not the case with Docutils (since at least 2004)
5252 (cf. test/functional/input/data/standard.txt)
5254 An additional restriction, which cannot be expressed in the language
5255 of DTDs, is imposed by software:
5257 * A transition may not occur at the end of a document or section.
5259 The `%structure.model;`_ parameter entity is directly employed in the
5260 content models of the document_ and section_ elements.
5266 The ``%text.model;`` parameter entity is used by many elements to
5267 represent text data mixed with `inline elements`_.
5273 (#PCDATA | `%inline.elements;`_)*
5275 The ``%text.model;`` parameter entity is directly employed in the
5276 content models of the following elements: abbreviation_, acronym_,
5277 address_, author_, caption_, classifier_, contact_, copyright_, date_,
5278 doctest_block_, emphasis_, field_name_, generated_, line_block_,
5279 literal_block_, organization_, paragraph_, problematic_, raw_,
5280 reference_, revision_, status_, strong_, substitution_definition_,
5281 substitution_reference_, subtitle_, target_, term_, title_, version_
5288 indent-tabs-mode: nil
5289 sentence-end-double-space: t