| Server IP : 82.148.16.210 / Your IP : 216.73.216.249 Web Server : nginx/1.29.5 System : Linux mail.sarafai.ru 6.1.0-43-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.162-1 (2026-02-08) x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/thread-self/root/usr/share/doc/python3-docutils/docs/ref/rst/ |
Upload File : |
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<title>reStructuredText Directives</title>
<meta name="author" content="David Goodger" />
<meta name="date" content="2022-06-17" />
<meta name="copyright" content="This document has been placed in the public domain." />
<link rel="stylesheet" href="../../../css/html4css1.css" type="text/css" />
</head>
<body>
<div class="header">
<a class="reference external" href="https://docutils.sourceforge.io">Docutils</a> | <a class="reference external" href="../../index.html">Overview</a> | <a class="reference external" href="../../index.html#project-fundamentals">About</a> | <a class="reference external" href="../../index.html#user">Users</a> | <a class="reference external" href="../../index.html#ref">Reference</a> | <a class="reference external" href="../../index.html#howto">Developers</a>
<hr class="header"/>
</div>
<div class="document" id="restructuredtext-directives">
<h1 class="title">reStructuredText Directives</h1>
<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Author:</th>
<td>David Goodger</td></tr>
<tr><th class="docinfo-name">Contact:</th>
<td><a class="first last reference external" href="mailto:docutils-develop@lists.sourceforge.net">docutils-develop@lists.sourceforge.net</a></td></tr>
<tr><th class="docinfo-name">Revision:</th>
<td>9077</td></tr>
<tr><th class="docinfo-name">Date:</th>
<td>2022-06-17</td></tr>
<tr><th class="docinfo-name">Copyright:</th>
<td>This document has been placed in the public domain.</td></tr>
</tbody>
</table>
<!-- Minimal menu bar for inclusion in documentation sources
in ``docutils/docs/*/`` sub-sub-diretories.
Attention: this is not a standalone document. -->
<div class="contents topic" id="contents">
<p class="topic-title">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#admonitions" id="toc-entry-1">Admonitions</a><ul>
<li><a class="reference internal" href="#specific-admonitions" id="toc-entry-2">Specific Admonitions</a></li>
<li><a class="reference internal" href="#generic-admonition" id="toc-entry-3">Generic Admonition</a></li>
</ul>
</li>
<li><a class="reference internal" href="#images" id="toc-entry-4">Images</a><ul>
<li><a class="reference internal" href="#image" id="toc-entry-5">Image</a></li>
<li><a class="reference internal" href="#figure" id="toc-entry-6">Figure</a></li>
</ul>
</li>
<li><a class="reference internal" href="#body-elements" id="toc-entry-7">Body Elements</a><ul>
<li><a class="reference internal" href="#topic" id="toc-entry-8">Topic</a></li>
<li><a class="reference internal" href="#sidebar" id="toc-entry-9">Sidebar</a></li>
<li><a class="reference internal" href="#line-block" id="toc-entry-10">Line Block</a></li>
<li><a class="reference internal" href="#parsed-literal-block" id="toc-entry-11">Parsed Literal Block</a></li>
<li><a class="reference internal" href="#code" id="toc-entry-12">Code</a></li>
<li><a class="reference internal" href="#math" id="toc-entry-13">Math</a></li>
<li><a class="reference internal" href="#rubric" id="toc-entry-14">Rubric</a></li>
<li><a class="reference internal" href="#epigraph" id="toc-entry-15">Epigraph</a></li>
<li><a class="reference internal" href="#highlights" id="toc-entry-16">Highlights</a></li>
<li><a class="reference internal" href="#pull-quote" id="toc-entry-17">Pull-Quote</a></li>
<li><a class="reference internal" href="#compound-paragraph" id="toc-entry-18">Compound Paragraph</a></li>
<li><a class="reference internal" href="#container" id="toc-entry-19">Container</a></li>
</ul>
</li>
<li><a class="reference internal" href="#tables" id="toc-entry-20">Tables</a><ul>
<li><a class="reference internal" href="#table" id="toc-entry-21">Table</a></li>
<li><a class="reference internal" href="#csv-table-1" id="toc-entry-22">CSV Table</a></li>
<li><a class="reference internal" href="#list-table" id="toc-entry-23">List Table</a></li>
</ul>
</li>
<li><a class="reference internal" href="#document-parts" id="toc-entry-24">Document Parts</a><ul>
<li><a class="reference internal" href="#table-of-contents" id="toc-entry-25">Table of Contents</a></li>
<li><a class="reference internal" href="#automatic-section-numbering" id="toc-entry-26">Automatic Section Numbering</a></li>
<li><a class="reference internal" href="#document-header-footer" id="toc-entry-27">Document Header & Footer</a></li>
</ul>
</li>
<li><a class="reference internal" href="#references" id="toc-entry-28">References</a><ul>
<li><a class="reference internal" href="#target-footnotes" id="toc-entry-29">Target Footnotes</a></li>
<li><a class="reference internal" href="#footnotes" id="toc-entry-30">Footnotes</a></li>
<li><a class="reference internal" href="#citations" id="toc-entry-31">Citations</a></li>
</ul>
</li>
<li><a class="reference internal" href="#html-specific" id="toc-entry-32">HTML-Specific</a><ul>
<li><a class="reference internal" href="#imagemap" id="toc-entry-33">Imagemap</a></li>
</ul>
</li>
<li><a class="reference internal" href="#directives-for-substitution-definitions" id="toc-entry-34">Directives for Substitution Definitions</a><ul>
<li><a class="reference internal" href="#replacement-text" id="toc-entry-35">Replacement Text</a></li>
<li><a class="reference internal" href="#unicode-character-codes" id="toc-entry-36">Unicode Character Codes</a></li>
<li><a class="reference internal" href="#date" id="toc-entry-37">Date</a></li>
</ul>
</li>
<li><a class="reference internal" href="#miscellaneous" id="toc-entry-38">Miscellaneous</a><ul>
<li><a class="reference internal" href="#including-an-external-document-fragment" id="toc-entry-39">Including an External Document Fragment</a></li>
<li><a class="reference internal" href="#raw-data-pass-through" id="toc-entry-40">Raw Data Pass-Through</a></li>
<li><a class="reference internal" href="#class" id="toc-entry-41">Class</a></li>
<li><a class="reference internal" href="#custom-interpreted-text-roles" id="toc-entry-42">Custom Interpreted Text Roles</a></li>
<li><a class="reference internal" href="#setting-the-default-interpreted-text-role" id="toc-entry-43">Setting the Default Interpreted Text Role</a></li>
<li><a class="reference internal" href="#metadata" id="toc-entry-44">Metadata</a></li>
<li><a class="reference internal" href="#metadata-document-title" id="toc-entry-45">Metadata Document Title</a></li>
<li><a class="reference internal" href="#restructuredtext-test-directive" id="toc-entry-46">Restructuredtext-Test-Directive</a></li>
</ul>
</li>
<li><a class="reference internal" href="#common-options" id="toc-entry-47">Common Options</a></li>
</ul>
</div>
<p>This document describes the directives implemented in the reference
reStructuredText parser.</p>
<p>Directives have the following syntax:</p>
<pre class="literal-block">
+-------+-------------------------------+
| ".. " | directive type "::" directive |
+-------+ block |
| |
+-------------------------------+
</pre>
<p>Directives begin with an explicit markup start (two periods and a
space), followed by the directive type and two colons (collectively,
the "directive marker"). The directive block begins immediately after
the directive marker, and includes all subsequent indented lines. The
directive block is divided into arguments, options (a field list), and
content (in that order), any of which may appear. See the <a class="reference external" href="restructuredtext.html#directives">Directives</a>
section in the <a class="reference external" href="restructuredtext.html">reStructuredText Markup Specification</a> for syntax
details.</p>
<p>Descriptions below list "doctree elements" (document tree element
names; XML DTD generic identifiers) corresponding to individual
directives. For details on the hierarchy of elements, please see <a class="reference external" href="../doctree.html">The
Docutils Document Tree</a> and the <a class="reference external" href="../docutils.dtd">Docutils Generic DTD</a> XML document
type definition. For directive implementation details, see <a class="reference external" href="../../howto/rst-directives.html">Creating
reStructuredText Directives</a>.</p>
<div class="section" id="admonitions">
<h1><a class="toc-backref" href="#toc-entry-1">Admonitions</a></h1>
<!-- From Webster's Revised Unabridged Dictionary (1913) [web1913]:
Admonition
Gentle or friendly reproof; counseling against a fault or
error; expression of authoritative advice; friendly caution
or warning.
Syn: {Admonition}, {Reprehension}, {Reproof}.
Usage: Admonition is prospective, and relates to moral delinquencies;
its object is to prevent further transgression. -->
<div class="section" id="specific-admonitions">
<span id="warning"></span><span id="tip"></span><span id="note"></span><span id="important"></span><span id="hint"></span><span id="error"></span><span id="danger"></span><span id="caution"></span><span id="attention"></span><h2><a class="toc-backref" href="#toc-entry-2">Specific Admonitions</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Directive Types:</th></tr>
<tr class="field"><td> </td><td class="field-body">"attention", "caution", "danger", "error", "hint",
"important", "note", "tip", "warning", "admonition"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Elements:</th></tr>
<tr class="field"><td> </td><td class="field-body">attention, caution, danger, error, hint, important,
note, tip, warning, <a class="reference external" href="../doctree.html#admonition">admonition</a>, <a class="reference external" href="../doctree.html#title">title</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference internal" href="#class-1">class</a>, <a class="reference internal" href="#name">name</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">Interpreted as body elements.</td>
</tr>
</tbody>
</table>
<p>Admonitions are specially marked "topics" that can appear anywhere an
ordinary body element can. They contain arbitrary body elements.
Typically, an admonition is rendered as an offset block in a document,
sometimes outlined or shaded, with a title matching the admonition
type. For example:</p>
<pre class="literal-block">
.. DANGER::
Beware killer rabbits!
</pre>
<p>This directive might be rendered something like this:</p>
<pre class="literal-block">
+------------------------+
| !DANGER! |
| |
| Beware killer rabbits! |
+------------------------+
</pre>
<p>The following admonition directives have been implemented:</p>
<ul class="simple">
<li>attention</li>
<li>caution</li>
<li>danger</li>
<li>error</li>
<li>hint</li>
<li>important</li>
<li>note</li>
<li>tip</li>
<li>warning</li>
</ul>
<p>Any text immediately following the directive indicator (on the same
line and/or indented on following lines) is interpreted as a directive
block and is parsed for normal body elements. For example, the
following "note" admonition directive contains one paragraph and a
bullet list consisting of two list items:</p>
<pre class="literal-block">
.. note:: This is a note admonition.
This is the second line of the first paragraph.
- The note contains all indented body elements
following.
- It includes this bullet list.
</pre>
</div>
<div class="section" id="generic-admonition">
<h2><a class="toc-backref" href="#toc-entry-3">Generic Admonition</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"admonition"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Elements:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#admonition">admonition</a>, <a class="reference external" href="../doctree.html#title">title</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">One, required (admonition title)</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference internal" href="#class-1">class</a>, <a class="reference internal" href="#name">name</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">Interpreted as body elements.</td>
</tr>
</tbody>
</table>
<p>This is a generic, titled admonition. The title may be anything the
author desires.</p>
<p>The author-supplied title is also used as a <a class="reference external" href="../doctree.html#classes">"classes"</a> attribute value
after being converted into a valid identifier form (down-cased;
non-alphanumeric characters converted to single hyphens; "admonition-"
prefixed). For example, this admonition:</p>
<pre class="literal-block">
.. admonition:: And, by the way...
You can make up your own admonition too.
</pre>
<p>becomes the following document tree (pseudo-XML):</p>
<pre class="literal-block">
<document source="test data">
<admonition classes="admonition-and-by-the-way">
<title>
And, by the way...
<paragraph>
You can make up your own admonition too.
</pre>
<p>The <a class="reference internal" href="#class-1">class</a> option overrides the computed <a class="reference external" href="../doctree.html#classes">"classes"</a> attribute
value.</p>
</div>
</div>
<div class="section" id="images">
<h1><a class="toc-backref" href="#toc-entry-4">Images</a></h1>
<p>There are two image directives: "image" and "figure".</p>
<div class="admonition attention">
<p class="first admonition-title">Attention!</p>
<p>It is up to the author to ensure compatibility of the image data format
with the output format or user agent (LaTeX engine, <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types">HTML browser</a>).
The following, non exhaustive table provides an overview:</p>
<table border="1" class="docutils">
<colgroup>
<col width="17%" />
<col width="10%" />
<col width="10%" />
<col width="8%" />
<col width="8%" />
<col width="8%" />
<col width="8%" />
<col width="8%" />
<col width="8%" />
<col width="8%" />
<col width="8%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head"><!-- -->
</th>
<th class="head" colspan="2">vector image</th>
<th class="head" colspan="5">raster image</th>
<th class="head" colspan="3">moving image <a class="footnote-reference" href="#footnote-1" id="footnote-reference-1">[1]</a></th>
</tr>
<tr><th class="head"><!-- -->
</th>
<th class="head">SVG</th>
<th class="head">PDF</th>
<th class="head">PNG</th>
<th class="head">JPG</th>
<th class="head">GIF</th>
<th class="head">APNG</th>
<th class="head">AVIF</th>
<th class="head">WebM</th>
<th class="head">MP4</th>
<th class="head">OGG</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><a class="reference external" href="../../user/html.html#html4css1">HTML4</a></td>
<td>✓ <a class="footnote-reference" href="#footnote-2" id="footnote-reference-2">[2]</a></td>
<td> </td>
<td>✓</td>
<td>✓</td>
<td>✓</td>
<td>(✓)</td>
<td>(✓)</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr><td><a class="reference external" href="../../user/html.html#html5-polyglot">HTML5</a></td>
<td>✓</td>
<td> </td>
<td>✓</td>
<td>✓</td>
<td>✓</td>
<td>✓</td>
<td>✓</td>
<td>✓</td>
<td>✓</td>
<td>✓</td>
</tr>
<tr><td><a class="reference external" href="../../user/latex.html#image-inclusion">LaTeX</a> <a class="footnote-reference" href="#footnote-3" id="footnote-reference-3">[3]</a></td>
<td> </td>
<td>✓</td>
<td>✓</td>
<td>✓</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr><td><a class="reference external" href="../../user/odt.html">ODT</a></td>
<td>✓</td>
<td>✓</td>
<td>✓</td>
<td>✓</td>
<td>✓</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="footnote-1" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#footnote-reference-1">[1]</a></td><td>The <a class="reference external" href="../../user/html.html#html5-polyglot">html5 writer</a> uses the <tt class="docutils literal"><video></tt> tag if the image URI
ends with an extension matching one of the listed video formats
(since Docutils 0.17).</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="footnote-2" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#footnote-reference-2">[2]</a></td><td>The html4 writer uses an <tt class="docutils literal"><object></tt> tag for SVG images
for better compatibility with older browsers.</td></tr>
</tbody>
</table>
<table class="last docutils footnote" frame="void" id="footnote-3" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#footnote-reference-3">[3]</a></td><td>When compiling with <tt class="docutils literal">pdflatex</tt>, <tt class="docutils literal">xelatex</tt>, or <tt class="docutils literal">lualatex</tt>.
The original <tt class="docutils literal">latex</tt> engine supports only the EPS image format.
Some build systems, e.g. <a class="reference external" href="https://github.com/petrhosek/rubber">rubber</a> support additional formats
via on-the-fly image conversion.</td></tr>
</tbody>
</table>
</div>
<div class="section" id="image">
<h2><a class="toc-backref" href="#toc-entry-5">Image</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"image"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#image">image</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">One, required (image URI).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">Possible (see below).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
</tbody>
</table>
<p>An "image" is a simple picture:</p>
<pre class="literal-block">
.. image:: picture.png
</pre>
<p>Inline images can be defined with an "image" directive in a <a class="reference external" href="restructuredtext.html#substitution-definitions">substitution
definition</a></p>
<p>The URI for the image source file is specified in the directive
argument. As with hyperlink targets, the image URI may begin on the
same line as the explicit markup start and target name, or it may
begin in an indented text block immediately following, with no
intervening blank lines. If there are multiple lines in the link
block, they are stripped of leading and trailing whitespace and joined
together.</p>
<p>Optionally, the image link block may contain a flat field list, the
<span class="target" id="image-options">image options</span>. For example:</p>
<pre class="literal-block">
.. image:: picture.jpeg
:height: 100px
:width: 200 px
:scale: 50 %
:alt: alternate text
:align: right
</pre>
<p>The following options are recognized:</p>
<dl class="docutils">
<dt><tt class="docutils literal">alt</tt> <span class="classifier-delimiter">:</span> <span class="classifier">text</span></dt>
<dd>Alternate text: a short description of the image, displayed by
applications that cannot display images, or spoken by applications
for visually impaired users.</dd>
<dt><tt class="docutils literal">height</tt> <span class="classifier-delimiter">:</span> <span class="classifier"><a class="reference external" href="restructuredtext.html#length-units">length</a></span></dt>
<dd>The desired height of the image.
Used to reserve space or scale the image vertically. When the "scale"
option is also specified, they are combined. For example, a height of
200px and a scale of 50 is equivalent to a height of 100px with no scale.</dd>
<dt><tt class="docutils literal">width</tt> <span class="classifier-delimiter">:</span> <span class="classifier"><a class="reference external" href="restructuredtext.html#length-units">length</a> or <a class="reference external" href="restructuredtext.html#percentage-units">percentage</a> of the current line width</span></dt>
<dd>The width of the image.
Used to reserve space or scale the image horizontally. As with "height"
above, when the "scale" option is also specified, they are combined.</dd>
<dt><tt class="docutils literal">scale</tt> <span class="classifier-delimiter">:</span> <span class="classifier">integer percentage (the "%" symbol is optional)</span></dt>
<dd><p class="first">The uniform scaling factor of the image. The default is "100 %", i.e.
no scaling.</p>
<p class="last">If no "height" or "width" options are specified, the <cite>Python
Imaging Library</cite> (PIL/<a class="reference external" href="https://pypi.org/project/Pillow/">Pillow</a>) may be used to determine them, if
it is installed and the image file is available.</p>
</dd>
<dt><tt class="docutils literal">align</tt> <span class="classifier-delimiter">:</span> <span class="classifier">"top", "middle", "bottom", "left", "center", or "right"</span></dt>
<dd>The alignment of the image, equivalent to the HTML <tt class="docutils literal"><img></tt> tag's
deprecated "align" attribute or the corresponding "vertical-align" and
"text-align" CSS properties.
The values "top", "middle", and "bottom"
control an image's vertical alignment (relative to the text
baseline); they are only useful for inline images (substitutions).
The values "left", "center", and "right" control an image's
horizontal alignment, allowing the image to float and have the
text flow around it. The specific behavior depends upon the
browser or rendering software used.</dd>
<dt><tt class="docutils literal">target</tt> <span class="classifier-delimiter">:</span> <span class="classifier">text (URI or reference name)</span></dt>
<dd>Makes the image into a hyperlink reference ("clickable"). The
option argument may be a URI (relative or absolute), or a
<a class="reference external" href="restructuredtext.html#reference-names">reference name</a> with underscore suffix (e.g. <tt class="docutils literal">`a name`_</tt>).</dd>
</dl>
<p>and the common options <a class="reference internal" href="#class-1">class</a> and <a class="reference internal" href="#name">name</a>.</p>
</div>
<div class="section" id="figure">
<h2><a class="toc-backref" href="#toc-entry-6">Figure</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"figure"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Elements:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#figure">figure</a>, <a class="reference external" href="../doctree.html#image">image</a>, <a class="reference external" href="../doctree.html#caption">caption</a>, <a class="reference external" href="../doctree.html#legend">legend</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">One, required (image URI).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">Possible (see below).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">Interpreted as the figure caption and an optional
legend.</td>
</tr>
</tbody>
</table>
<p>A "figure" consists of <a class="reference external" href="../doctree.html#image">image</a> data (including <a class="reference internal" href="#image-options">image options</a>), an optional
caption (a single paragraph), and an optional legend (arbitrary body
elements). For page-based output media, figures might float to a different
position if this helps the page layout.</p>
<pre class="literal-block">
.. figure:: picture.png
:scale: 50 %
:alt: map to buried treasure
This is the caption of the figure (a simple paragraph).
The legend consists of all elements after the caption. In this
case, the legend consists of this paragraph and the following
table:
+-----------------------+-----------------------+
| Symbol | Meaning |
+=======================+=======================+
| .. image:: tent.png | Campground |
+-----------------------+-----------------------+
| .. image:: waves.png | Lake |
+-----------------------+-----------------------+
| .. image:: peak.png | Mountain |
+-----------------------+-----------------------+
</pre>
<p>There must be blank lines before the caption paragraph and before the
legend. To specify a legend without a caption, use an empty comment
("..") in place of the caption.</p>
<p>The "figure" directive supports all of the options of the "image"
directive (see <a class="reference internal" href="#image-options">image options</a> above). These options (except
"align") are passed on to the contained image.</p>
<dl class="docutils">
<dt><tt class="docutils literal">align</tt> <span class="classifier-delimiter">:</span> <span class="classifier">"left", "center", or "right"</span></dt>
<dd>The horizontal alignment of the figure, allowing the image to
float and have the text flow around it. The specific behavior
depends upon the browser or rendering software used.</dd>
</dl>
<p>In addition, the following options are recognized:</p>
<dl class="docutils">
<dt><tt class="docutils literal">figwidth</tt> <span class="classifier-delimiter">:</span> <span class="classifier">"image", <a class="reference external" href="restructuredtext.html#length-units">length</a>, or <a class="reference external" href="restructuredtext.html#percentage-units">percentage</a> of current line width</span></dt>
<dd><p class="first">The width of the figure.
Limits the horizontal space used by the figure.
A special value of "image" is allowed, in which case the
included image's actual width is used (requires the <a class="reference external" href="https://pypi.org/project/Pillow/">Python Imaging
Library</a>). If the image file is not found or the required software is
unavailable, this option is ignored.</p>
<p>Sets the "width" attribute of the "figure" doctree element.</p>
<p>This option does not scale the included image; use the "width"
<a class="reference external" href="../doctree.html#image">image</a> option for that.</p>
<pre class="last literal-block">
+---------------------------+
| figure |
| |
|<------ figwidth --------->|
| |
| +---------------------+ |
| | image | |
| | | |
| |<--- width --------->| |
| +---------------------+ |
| |
|The figure's caption should|
|wrap at this width. |
+---------------------------+
</pre>
</dd>
<dt><tt class="docutils literal">figclass</tt> <span class="classifier-delimiter">:</span> <span class="classifier">text</span></dt>
<dd>Set a <a class="reference external" href="../doctree.html#classes">"classes"</a> attribute value on the figure element. See the
<a class="reference internal" href="#class-1">class</a> directive below.</dd>
</dl>
</div>
</div>
<div class="section" id="body-elements">
<h1><a class="toc-backref" href="#toc-entry-7">Body Elements</a></h1>
<div class="section" id="topic">
<h2><a class="toc-backref" href="#toc-entry-8">Topic</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"topic"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#topic">topic</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">One, required (topic title).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference internal" href="#class-1">class</a>, <a class="reference internal" href="#name">name</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">Interpreted as the topic body.</td>
</tr>
</tbody>
</table>
<p>A topic is like a block quote with a title, or a self-contained
section with no subsections. Use the "topic" directive to indicate a
self-contained idea that is separate from the flow of the document.
Topics may occur anywhere a section or transition may occur. Body
elements and topics may not contain nested topics.</p>
<p>The directive's sole argument is interpreted as the topic title; the
next line must be blank. All subsequent lines make up the topic body,
interpreted as body elements. For example:</p>
<pre class="literal-block">
.. topic:: Topic Title
Subsequent indented lines comprise
the body of the topic, and are
interpreted as body elements.
</pre>
</div>
<div class="section" id="sidebar">
<h2><a class="toc-backref" href="#toc-entry-9">Sidebar</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"sidebar"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#sidebar">sidebar</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">One, optional (sidebar title).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">Possible (see below).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">Interpreted as the sidebar body.</td>
</tr>
</tbody>
</table>
<p>Sidebars are like miniature, parallel documents that occur inside
other documents, providing related or reference material. A sidebar
is typically offset by a border and "floats" to the side of the page;
the document's main text may flow around it. Sidebars can also be
likened to super-footnotes; their content is outside of the flow of
the document's main text.</p>
<p>Sidebars may occur anywhere a section or transition may occur. Body
elements (including sidebars) may not contain nested sidebars.</p>
<p>The directive's sole argument is interpreted as the sidebar title,
which may be followed by a subtitle option (see below); the next line
must be blank. All subsequent lines make up the sidebar body,
interpreted as body elements. For example:</p>
<pre class="literal-block">
.. sidebar:: Optional Sidebar Title
:subtitle: Optional Sidebar Subtitle
Subsequent indented lines comprise
the body of the sidebar, and are
interpreted as body elements.
</pre>
<p>The following options are recognized:</p>
<dl class="docutils">
<dt><tt class="docutils literal">subtitle</tt> <span class="classifier-delimiter">:</span> <span class="classifier">text</span></dt>
<dd>The sidebar's subtitle.</dd>
</dl>
<p>and the common options <a class="reference internal" href="#class-1">class</a> and <a class="reference internal" href="#name">name</a>.</p>
</div>
<div class="section" id="line-block">
<h2><a class="toc-backref" href="#toc-entry-10">Line Block</a></h2>
<div class="admonition admonition-deprecated">
<p class="first admonition-title">Deprecated</p>
<p class="last">The "line-block" directive is deprecated. Use the <a class="reference external" href="restructuredtext.html#line-blocks">line block
syntax</a> instead.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"line-block"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#line-block">line_block</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference internal" href="#class-1">class</a>, <a class="reference internal" href="#name">name</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">Becomes the body of the line block.</td>
</tr>
</tbody>
</table>
<p>The "line-block" directive constructs an element where line breaks and
initial indentation is significant and inline markup is supported. It
is equivalent to a <a class="reference internal" href="#parsed-literal-block">parsed literal block</a> with different rendering:
typically in an ordinary serif typeface instead of a
typewriter/monospaced face, and not automatically indented. (Have the
line-block directive begin a block quote to get an indented line
block.) Line blocks are useful for address blocks and verse (poetry,
song lyrics), where the structure of lines is significant. For
example, here's a classic:</p>
<pre class="literal-block">
"To Ma Own Beloved Lassie: A Poem on her 17th Birthday", by
Ewan McTeagle (for Lassie O'Shea):
.. line-block::
Lend us a couple of bob till Thursday.
I'm absolutely skint.
But I'm expecting a postal order and I can pay you back
as soon as it comes.
Love, Ewan.
</pre>
</div>
<div class="section" id="parsed-literal-block">
<span id="parsed-literal"></span><h2><a class="toc-backref" href="#toc-entry-11">Parsed Literal Block</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"parsed-literal"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#literal-block">literal_block</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference internal" href="#class-1">class</a>, <a class="reference internal" href="#name">name</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">Becomes the body of the literal block.</td>
</tr>
</tbody>
</table>
<p>Unlike an ordinary literal block, the "parsed-literal" directive
constructs a literal block where the text is parsed for inline markup.
It is equivalent to a <a class="reference internal" href="#line-block">line block</a> with different rendering:
typically in a typewriter/monospaced typeface, like an ordinary
literal block. Parsed literal blocks are useful for adding hyperlinks
to code examples.</p>
<p>However, care must be taken with the text, because inline markup is
recognized and there is no protection from parsing. Backslash-escapes
may be necessary to prevent unintended parsing. And because the
markup characters are removed by the parser, care must also be taken
with vertical alignment. Parsed "ASCII art" is tricky, and extra
whitespace may be necessary.</p>
<p>For example, all the element names in this content model are links:</p>
<pre class="literal-block">
.. parsed-literal::
( (title_, subtitle_?)?,
decoration_?,
(docinfo_, transition_?)?,
`%structure.model;`_ )
</pre>
</div>
<div class="section" id="code">
<h2><a class="toc-backref" href="#toc-entry-12">Code</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"code"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#literal-block">literal_block</a>, <a class="reference external" href="../doctree.html#inline-elements">inline elements</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">One, optional (formal language).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">name, class, number-lines.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">Becomes the body of the literal block.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Configuration Setting:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../../user/config.html#syntax-highlight">syntax_highlight</a>.</td>
</tr>
</tbody>
</table>
<p>The "code" directive constructs a literal block. If the code language is
specified, the content is parsed by the <a class="reference external" href="https://pygments.org/">Pygments</a> syntax highlighter and
tokens are stored in nested <a class="reference external" href="../doctree.html#inline-elements">inline elements</a> with class arguments
according to their syntactic category. The actual highlighting requires
a style-sheet (e.g. one <a class="reference external" href="https://pygments.org/docs/cmdline/#generating-styles">generated by Pygments</a>, see the
<a class="reference external" href="https://docutils.sourceforge.io/sandbox/stylesheets/">sandbox/stylesheets</a> for examples).</p>
<p>The parsing can be turned off with the <a class="reference external" href="../../user/config.html#syntax-highlight">syntax_highlight</a> configuration
setting and command line option or by specifying the language as <a class="reference internal" href="#class-1">class</a>
option instead of directive argument. This also avoids warnings
when <a class="reference external" href="https://pygments.org/">Pygments</a> is not installed or the language is not in the
<a class="reference external" href="https://pygments.org/languages/">supported languages and markup formats</a>.</p>
<p>For inline code, use the <a class="reference external" href="roles.html#code">"code" role</a>.</p>
<p>The following options are recognized:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">number-lines</span></tt> <span class="classifier-delimiter">:</span> <span class="classifier">[integer] (start line number)</span></dt>
<dd>Precede every line with a line number.
The optional argument is the number of the first line (default 1).</dd>
</dl>
<p>and the common options <a class="reference internal" href="#class-1">class</a> and <a class="reference internal" href="#name">name</a>.</p>
<dl class="docutils">
<dt>Example::</dt>
<dd><p class="first">The content of the following directive</p>
<pre class="literal-block">
.. code:: python
def my_function():
"just a test"
print 8/2
</pre>
<p class="last">is parsed and marked up as Python source code.</p>
</dd>
</dl>
</div>
<div class="section" id="math">
<h2><a class="toc-backref" href="#toc-entry-13">Math</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"math"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#math-block">math_block</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference internal" href="#class-1">class</a>, <a class="reference internal" href="#name">name</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">Becomes the body of the math block.
(Content blocks separated by a blank line are put in
adjacent math blocks.)</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Configuration Setting:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../../user/config.html#math-output">math_output</a></td>
</tr>
</tbody>
</table>
<p>The "math" directive inserts blocks with mathematical content
(display formulas, equations) into the document. The input format is
<a class="reference external" href="../../ref/rst/mathematics.html">LaTeX math syntax</a> with support for Unicode symbols, for example:</p>
<pre class="literal-block">
.. math::
α_t(i) = P(O_1, O_2, … O_t, q_t = S_i λ)
</pre>
<p>Support is limited to a subset of <em>LaTeX math</em> by the conversion
required for many output formats. For HTML, the <a class="reference external" href="../../user/config.html#math-output">math_output</a>
configuration setting (or the corresponding <tt class="docutils literal"><span class="pre">--math-output</span></tt>
command line option) select between alternative output formats with
different subsets of supported elements. If a writer does not
support math typesetting, the content is inserted verbatim.</p>
<p>For inline formulas, use the <a class="reference external" href="roles.html#math">"math" role</a>.</p>
</div>
<div class="section" id="rubric">
<h2><a class="toc-backref" href="#toc-entry-14">Rubric</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"rubric"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#rubric">rubric</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">One, required (rubric text).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference internal" href="#class-1">class</a>, <a class="reference internal" href="#name">name</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
</tbody>
</table>
<!-- -->
<blockquote>
<p>rubric n. 1. a title, heading, or the like, in a manuscript,
book, statute, etc., written or printed in red or otherwise
distinguished from the rest of the text. ...</p>
<p class="attribution">—Random House Webster's College Dictionary, 1991</p>
</blockquote>
<p>The "rubric" directive inserts a "rubric" element into the document
tree. A rubric is like an informal heading that doesn't correspond to
the document's structure.</p>
</div>
<div class="section" id="epigraph">
<h2><a class="toc-backref" href="#toc-entry-15">Epigraph</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"epigraph"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#block-quote">block_quote</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">Interpreted as the body of the block quote.</td>
</tr>
</tbody>
</table>
<p>An epigraph is an apposite (suitable, apt, or pertinent) short
inscription, often a quotation or poem, at the beginning of a document
or section.</p>
<p>The "epigraph" directive produces an "epigraph"-class block quote.
For example, this input:</p>
<pre class="literal-block">
.. epigraph::
No matter where you go, there you are.
-- Buckaroo Banzai
</pre>
<p>becomes this document tree fragment:</p>
<pre class="literal-block">
<block_quote classes="epigraph">
<paragraph>
No matter where you go, there you are.
<attribution>
Buckaroo Banzai
</pre>
</div>
<div class="section" id="highlights">
<h2><a class="toc-backref" href="#toc-entry-16">Highlights</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"highlights"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#block-quote">block_quote</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">Interpreted as the body of the block quote.</td>
</tr>
</tbody>
</table>
<p>Highlights summarize the main points of a document or section, often
consisting of a list.</p>
<p>The "highlights" directive produces a "highlights"-class block quote.
See <a class="reference internal" href="#epigraph">Epigraph</a> above for an analogous example.</p>
</div>
<div class="section" id="pull-quote">
<h2><a class="toc-backref" href="#toc-entry-17">Pull-Quote</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"pull-quote"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#block-quote">block_quote</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">Interpreted as the body of the block quote.</td>
</tr>
</tbody>
</table>
<p>A pull-quote is a small selection of text "pulled out and quoted",
typically in a larger typeface. Pull-quotes are used to attract
attention, especially in long articles.</p>
<p>The "pull-quote" directive produces a "pull-quote"-class block quote.
See <a class="reference internal" href="#epigraph">Epigraph</a> above for an analogous example.</p>
</div>
<div class="section" id="compound-paragraph">
<h2><a class="toc-backref" href="#toc-entry-18">Compound Paragraph</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"compound"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#compound">compound</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference internal" href="#class-1">class</a>, <a class="reference internal" href="#name">name</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">Interpreted as body elements.</td>
</tr>
</tbody>
</table>
<p>The "compound" directive is used to create a compound paragraph, which
is a single logical paragraph containing multiple physical body
elements such as simple paragraphs, literal blocks, tables, lists,
etc., instead of directly containing text and inline elements. For
example:</p>
<pre class="literal-block">
.. compound::
The 'rm' command is very dangerous. If you are logged
in as root and enter ::
cd /
rm -rf *
you will erase the entire contents of your file system.
</pre>
<p>In the example above, a literal block is "embedded" within a sentence
that begins in one physical paragraph and ends in another.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>The "compound" directive is <em>not</em> a generic block-level container
like HTML's <tt class="docutils literal"><div></tt> element. Do not use it only to group a
sequence of elements, or you may get unexpected results.</p>
<p class="last">If you need a generic block-level container, please use the
<a class="reference internal" href="#container">container</a> directive, described below.</p>
</div>
<p>Compound paragraphs are typically rendered as multiple distinct text
blocks, with the possibility of variations to emphasize their logical
unity:</p>
<ul class="simple">
<li>If paragraphs are rendered with a first-line indent, only the first
physical paragraph of a compound paragraph should have that indent
-- second and further physical paragraphs should omit the indents;</li>
<li>vertical spacing between physical elements may be reduced;</li>
<li>and so on.</li>
</ul>
</div>
<div class="section" id="container">
<h2><a class="toc-backref" href="#toc-entry-19">Container</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"container"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#container">container</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">One or more, optional (class names).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference internal" href="#name">name</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">Interpreted as body elements.</td>
</tr>
</tbody>
</table>
<p>The "container" directive surrounds its contents (arbitrary body
elements) with a generic block-level "container" element. Combined
with the optional "<a class="reference internal" href="#classes">classes</a>" attribute argument(s), this is an
extension mechanism for users & applications. For example:</p>
<pre class="literal-block">
.. container:: custom
This paragraph might be rendered in a custom way.
</pre>
<p>Parsing the above results in the following pseudo-XML:</p>
<pre class="literal-block">
<container classes="custom">
<paragraph>
This paragraph might be rendered in a custom way.
</pre>
<p>The "container" directive is the equivalent of HTML's <tt class="docutils literal"><div></tt>
element. It may be used to group a sequence of elements for user- or
application-specific purposes.</p>
</div>
</div>
<div class="section" id="tables">
<h1><a class="toc-backref" href="#toc-entry-20">Tables</a></h1>
<p>Formal tables need more structure than the reStructuredText syntax
supplies. Tables may be given titles with the <a class="reference external" href="../doctree.html#table">table</a> directive.
Sometimes reStructuredText tables are inconvenient to write, or table
data in a standard format is readily available. The <a class="reference internal" href="#csv-table">csv-table</a>
directive supports CSV data.</p>
<div class="section" id="table">
<h2><a class="toc-backref" href="#toc-entry-21">Table</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"table"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#table">table</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">One, optional (table title).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">Possible (see below).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">A normal <a class="reference external" href="restructuredtext.html#tables">reStructuredText table</a>.</td>
</tr>
</tbody>
</table>
<p>The "table" directive is used to associate a
title with a table or specify options, e.g.:</p>
<pre class="literal-block">
.. table:: Truth table for "not"
:widths: auto
===== =====
A not A
===== =====
False True
True False
===== =====
</pre>
<p>The following options are recognized:</p>
<dl class="docutils">
<dt><tt class="docutils literal">align</tt> <span class="classifier-delimiter">:</span> <span class="classifier">"left", "center", or "right"</span></dt>
<dd>The horizontal alignment of the table (new in Docutils 0.13).</dd>
<dt><tt class="docutils literal">width</tt> <span class="classifier-delimiter">:</span> <span class="classifier"><a class="reference external" href="restructuredtext.html#length-units">length</a> or <a class="reference external" href="restructuredtext.html#percentage-units">percentage</a></span></dt>
<dd>Sets the width of the table to the specified length or percentage
of the line width. If omitted, the renderer determines the width
of the table based on its contents or the column <tt class="docutils literal">widths</tt>.</dd>
<dt id="column-widths"><tt class="docutils literal">widths</tt> <span class="classifier-delimiter">:</span> <span class="classifier">"auto", "grid", or a list of integers</span></dt>
<dd><p class="first">Explicitly set column widths.
Specifies relative widths if used with the <tt class="docutils literal">width</tt> option.
Overrides a <a class="reference external" href="../../user/config.html#table-style">table_style</a> setting or class value "colwidths-auto".
The default depends on the <a class="reference external" href="../../user/config.html#table-style">table_style</a> configuration setting.</p>
<p><em>"auto"</em> delegates the determination of column widths to the backend
(LaTeX, the HTML browser, ...).
Default for the <a class="reference external" href="../../user/html.html#html5-polyglot">html5 writer</a></p>
<p><em>"grid"</em> determines column widths from the widths of the input columns
(in characters).
Default for most writers.</p>
<p class="last">A <em>list of integers</em> is used instead of the input column widths.
Implies <em>"grid"</em>.</p>
</dd>
</dl>
<p>Plus the common options <a class="reference internal" href="#class-1">class</a> and <a class="reference internal" href="#name">name</a>.</p>
</div>
<div class="section" id="csv-table-1">
<span id="csv-table"></span><h2><a class="toc-backref" href="#toc-entry-22">CSV Table</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"csv-table"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#table">table</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">One, optional (table title).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">Possible (see below).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">A CSV (comma-separated values) table.</td>
</tr>
</tbody>
</table>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">The "csv-table" directive's ":file:" and ":url:" options represent
a potential security holes. They can be disabled with the
"<a class="reference external" href="../../user/config.html#file-insertion-enabled">file_insertion_enabled</a>" runtime setting.</p>
</div>
<p>The "csv-table" directive is used to create a table from CSV
(comma-separated values) data. CSV is a common data format generated
by spreadsheet applications and commercial databases. The data may be
internal (an integral part of the document) or external (a separate
file).</p>
<ul class="simple">
<li>Block markup and inline markup within cells is supported. Line ends
are recognized within cells.</li>
<li>There is no support for checking that the number of columns in each
row is the same. The directive automatically adds empty entries at
the end of short rows.<!-- Add "strict" option to verify input? -->
</li>
</ul>
<p>Example:</p>
<pre class="literal-block">
.. csv-table:: Frozen Delights!
:header: "Treat", "Quantity", "Description"
:widths: 15, 10, 30
"Albatross", 2.99, "On a stick!"
"Crunchy Frog", 1.49, "If we took the bones out, it wouldn't be
crunchy, now would it?"
"Gannet Ripple", 1.99, "On a stick!"
</pre>
<p>The following options are recognized:</p>
<dl class="docutils">
<dt><tt class="docutils literal">align</tt> <span class="classifier-delimiter">:</span> <span class="classifier">"left", "center", or "right"</span></dt>
<dd>The horizontal alignment of the table. (New in Docutils 0.13)</dd>
<dt><tt class="docutils literal">delim</tt> <span class="classifier-delimiter">:</span> <span class="classifier">char | "tab" | "space" <a class="footnote-reference" href="#whitespace-delim" id="footnote-reference-4">[4]</a></span></dt>
<dd>A one-character string used to separate fields.
Defaults to <tt class="docutils literal">,</tt> (comma). May be specified as a Unicode code
point; see the <a class="reference internal" href="#unicode">unicode</a> directive for syntax details.</dd>
<dt><tt class="docutils literal">encoding</tt> <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
<dd>The text encoding of the external CSV data (file or URL).
Defaults to the document's <a class="reference external" href="../../user/config.html#input-encoding">input_encoding</a>.</dd>
<dt><tt class="docutils literal">escape</tt> <span class="classifier-delimiter">:</span> <span class="classifier">char</span></dt>
<dd>A one-character string used to escape the
delimiter or quote characters. May be specified as a Unicode
code point; see the <a class="reference internal" href="#unicode">unicode</a> directive for syntax details. Used
when the delimiter is used in an unquoted field, or when quote
characters are used within a field. The default is to double-up
the character, e.g. "He said, ""Hi!"""<!-- Add another possible value, "double", to explicitly indicate
the default case? -->
</dd>
<dt><tt class="docutils literal">file</tt> <span class="classifier-delimiter">:</span> <span class="classifier">string (newlines removed)</span></dt>
<dd>The local filesystem path to a CSV data file.</dd>
<dt><tt class="docutils literal">header</tt> <span class="classifier-delimiter">:</span> <span class="classifier">CSV data</span></dt>
<dd>Supplemental data for the table header, added independently of and
before any <tt class="docutils literal"><span class="pre">header-rows</span></tt> from the main CSV data. Must use the
same CSV format as the main CSV data.</dd>
<dt><tt class="docutils literal"><span class="pre">header-rows</span></tt> <span class="classifier-delimiter">:</span> <span class="classifier">integer</span></dt>
<dd>The number of rows of CSV data to use in the table header.
Defaults to 0.</dd>
<dt><tt class="docutils literal">keepspace</tt> <span class="classifier-delimiter">:</span> <span class="classifier">flag (empty)</span></dt>
<dd>Treat whitespace immediately following the delimiter as
significant. The default is to ignore such whitespace.</dd>
<dt><tt class="docutils literal">quote</tt> <span class="classifier-delimiter">:</span> <span class="classifier">char</span></dt>
<dd>A one-character string used to quote elements
containing the delimiter or which start with the quote
character. Defaults to <tt class="docutils literal">"</tt> (quote). May be specified as a
Unicode code point; see the <a class="reference internal" href="#unicode">unicode</a> directive for syntax
details.</dd>
<dt><tt class="docutils literal"><span class="pre">stub-columns</span></tt> <span class="classifier-delimiter">:</span> <span class="classifier">integer</span></dt>
<dd>The number of table columns to use as stubs (row titles, on the
left). Defaults to 0.</dd>
<dt><tt class="docutils literal">url</tt> <span class="classifier-delimiter">:</span> <span class="classifier">string (whitespace removed)</span></dt>
<dd>An Internet URL reference to a CSV data file.</dd>
<dt><tt class="docutils literal">widths</tt> <span class="classifier-delimiter">:</span> <span class="classifier">integer [integer...] or "auto"</span></dt>
<dd><p class="first">A list of relative column widths.
The default is equal-width columns (100%/#columns).</p>
<p class="last">"auto" delegates the determination of column widths to the backend
(LaTeX, the HTML browser, ...).</p>
</dd>
<dt><tt class="docutils literal">width</tt> <span class="classifier-delimiter">:</span> <span class="classifier"><a class="reference external" href="restructuredtext.html#length-units">length</a> or <a class="reference external" href="restructuredtext.html#percentage-units">percentage</a></span></dt>
<dd>Sets the width of the table to the specified length or percentage
of the line width. If omitted, the renderer determines the width
of the table based on its contents or the column <tt class="docutils literal">widths</tt>.</dd>
</dl>
<p>and the common options <a class="reference internal" href="#class-1">class</a> and <a class="reference internal" href="#name">name</a>.</p>
<table class="docutils footnote" frame="void" id="whitespace-delim" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#footnote-reference-4">[4]</a></td><td>Whitespace delimiters are supported only for external
CSV files.</td></tr>
</tbody>
</table>
</div>
<div class="section" id="list-table">
<h2><a class="toc-backref" href="#toc-entry-23">List Table</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"list-table"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#table">table</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">One, optional (table title).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">Possible (see below).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">A uniform two-level bullet list.</td>
</tr>
</tbody>
</table>
<p>(This is an initial implementation; <a class="reference external" href="../../dev/rst/alternatives.html#list-driven-tables">further ideas</a> may be implemented
in the future.)</p>
<p>The "list-table" directive is used to create a table from data in a
uniform two-level bullet list. "Uniform" means that each sublist
(second-level list) must contain the same number of list items.</p>
<p>Example:</p>
<pre class="literal-block">
.. list-table:: Frozen Delights!
:widths: 15 10 30
:header-rows: 1
* - Treat
- Quantity
- Description
* - Albatross
- 2.99
- On a stick!
* - Crunchy Frog
- 1.49
- If we took the bones out, it wouldn't be
crunchy, now would it?
* - Gannet Ripple
- 1.99
- On a stick!
</pre>
<p>The following options are recognized:</p>
<dl class="docutils">
<dt><tt class="docutils literal">align</tt> <span class="classifier-delimiter">:</span> <span class="classifier">"left", "center", or "right"</span></dt>
<dd>The horizontal alignment of the table.
(New in Docutils 0.13)</dd>
<dt><tt class="docutils literal"><span class="pre">header-rows</span></tt> <span class="classifier-delimiter">:</span> <span class="classifier">integer</span></dt>
<dd>The number of rows of list data to use in the table header.
Defaults to 0.</dd>
<dt><tt class="docutils literal"><span class="pre">stub-columns</span></tt> <span class="classifier-delimiter">:</span> <span class="classifier">integer</span></dt>
<dd>The number of table columns to use as stubs (row titles, on the
left). Defaults to 0.</dd>
<dt id="table-width"><tt class="docutils literal">width</tt> <span class="classifier-delimiter">:</span> <span class="classifier"><a class="reference external" href="restructuredtext.html#length-units">length</a> or <a class="reference external" href="restructuredtext.html#percentage-units">percentage</a></span></dt>
<dd>Sets the width of the table to the specified length or percentage
of the line width. If omitted, the renderer determines the width
of the table based on its contents or the column <tt class="docutils literal">widths</tt>.</dd>
<dt id="column-widths-1"><tt class="docutils literal">widths</tt> <span class="classifier-delimiter">:</span> <span class="classifier">integer [integer...] or "auto"</span></dt>
<dd><p class="first">A list of relative column widths.
The default is equal-width columns (100%/#columns).</p>
<p class="last">"auto" delegates the determination of column widths to the backend
(LaTeX, the HTML browser, ...).</p>
</dd>
</dl>
<p>and the common options <a class="reference internal" href="#class-1">class</a> and <a class="reference internal" href="#name">name</a>.</p>
</div>
</div>
<div class="section" id="document-parts">
<h1><a class="toc-backref" href="#toc-entry-24">Document Parts</a></h1>
<div class="section" id="table-of-contents">
<span id="contents-1"></span><h2><a class="toc-backref" href="#toc-entry-25">Table of Contents</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"contents"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Elements:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#pending">pending</a>, <a class="reference external" href="../doctree.html#topic">topic</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">One, optional: title.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">Possible (see below).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
</tbody>
</table>
<p>The "contents" directive generates a table of contents (TOC) in a
<a class="reference external" href="../doctree.html#topic">topic</a>. Topics, and therefore tables of contents, may occur anywhere
a section or transition may occur. Body elements and topics may not
contain tables of contents.</p>
<p>Here's the directive in its simplest form:</p>
<pre class="literal-block">
.. contents::
</pre>
<p>Language-dependent boilerplate text will be used for the title. The
English default title text is "Contents".</p>
<p>An explicit title may be specified:</p>
<pre class="literal-block">
.. contents:: Table of Contents
</pre>
<p>The title may span lines, although it is not recommended:</p>
<pre class="literal-block">
.. contents:: Here's a very long Table of
Contents title
</pre>
<p>Options may be specified for the directive, using a field list:</p>
<pre class="literal-block">
.. contents:: Table of Contents
:depth: 2
</pre>
<p>If the default title is to be used, the options field list may begin
on the same line as the directive marker:</p>
<pre class="literal-block">
.. contents:: :depth: 2
</pre>
<p>The following options are recognized:</p>
<dl class="docutils">
<dt><tt class="docutils literal">depth</tt> <span class="classifier-delimiter">:</span> <span class="classifier">integer</span></dt>
<dd>The number of section levels that are collected in the table of
contents. The default is unlimited depth.</dd>
<dt><tt class="docutils literal">local</tt> <span class="classifier-delimiter">:</span> <span class="classifier">flag (empty)</span></dt>
<dd>Generate a local table of contents. Entries will only include
subsections of the section in which the directive is given. If no
explicit title is given, the table of contents will not be titled.</dd>
<dt><tt class="docutils literal">backlinks</tt> <span class="classifier-delimiter">:</span> <span class="classifier">"entry" or "top" or "none"</span></dt>
<dd>Generate links from section headers back to the table of contents
entries, the table of contents itself, or generate no back-links.</dd>
<dt><tt class="docutils literal">class</tt> <span class="classifier-delimiter">:</span> <span class="classifier">text</span></dt>
<dd>Set a <a class="reference external" href="../doctree.html#classes">"classes"</a> attribute value on the topic element. See the
<a class="reference internal" href="#class-1">class</a> directive below.</dd>
</dl>
</div>
<div class="section" id="automatic-section-numbering">
<span id="section-numbering"></span><span id="sectnum"></span><h2><a class="toc-backref" href="#toc-entry-26">Automatic Section Numbering</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"sectnum" or "section-numbering" (synonyms)</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Elements:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#pending">pending</a>, <a class="reference external" href="../doctree.html#generated">generated</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">Possible (see below).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Configuration Setting:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../../user/config.html#sectnum-xform">sectnum_xform</a></td>
</tr>
</tbody>
</table>
<p>The "sectnum" (or "section-numbering") directive automatically numbers
sections and subsections in a document (if not disabled by the
<tt class="docutils literal"><span class="pre">--no-section-numbering</span></tt> command line option or the <a class="reference external" href="../../user/config.html#sectnum-xform">sectnum_xform</a>
configuration setting).</p>
<p>Section numbers are of the "multiple enumeration" form, where each
level has a number, separated by periods. For example, the title of section
1, subsection 2, subsubsection 3 would have "1.2.3" prefixed.</p>
<p>The "sectnum" directive does its work in two passes: the initial parse
and a transform. During the initial parse, a "pending" element is
generated which acts as a placeholder, storing any options internally.
At a later stage in the processing, the "pending" element triggers a
transform, which adds section numbers to titles. Section numbers are
enclosed in a "generated" element, and titles have their "auto"
attribute set to "1".</p>
<p>The following options are recognized:</p>
<dl class="docutils">
<dt><tt class="docutils literal">depth</tt> <span class="classifier-delimiter">:</span> <span class="classifier">integer</span></dt>
<dd>The number of section levels that are numbered by this directive.
The default is unlimited depth.</dd>
<dt><tt class="docutils literal">prefix</tt> <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
<dd>An arbitrary string that is prefixed to the automatically
generated section numbers. It may be something like "3.2.", which
will produce "3.2.1", "3.2.2", "3.2.2.1", and so on. Note that
any separating punctuation (in the example, a period, ".") must be
explicitly provided. The default is no prefix.</dd>
<dt><tt class="docutils literal">suffix</tt> <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
<dd>An arbitrary string that is appended to the automatically
generated section numbers. The default is no suffix.</dd>
<dt><tt class="docutils literal">start</tt> <span class="classifier-delimiter">:</span> <span class="classifier">integer</span></dt>
<dd>The value that will be used for the first section number.
Combined with <tt class="docutils literal">prefix</tt>, this may be used to force the right
numbering for a document split over several source files. The
default is 1.</dd>
</dl>
</div>
<div class="section" id="document-header-footer">
<span id="footer"></span><span id="header"></span><h2><a class="toc-backref" href="#toc-entry-27">Document Header & Footer</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Directive Types:</th></tr>
<tr class="field"><td> </td><td class="field-body">"header" and "footer"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Elements:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#decoration">decoration</a>, header, footer</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">Interpreted as body elements.</td>
</tr>
</tbody>
</table>
<p>The "header" and "footer" directives create document decorations,
useful for page navigation, notes, time/datestamp, etc. For example:</p>
<pre class="literal-block">
.. header:: This space for rent.
</pre>
<p>This will add a paragraph to the document header, which will appear at
the top of the generated web page or at the top of every printed page.</p>
<p>These directives may be used multiple times, cumulatively. There is
currently support for only one header and footer.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>While it is possible to use the "header" and "footer" directives to
create navigational elements for web pages, you should be aware
that Docutils is meant to be used for <em>document</em> processing, and
that a navigation bar is not typically part of a document.</p>
<p class="last">Thus, you may soon find Docutils' abilities to be insufficient for
these purposes. At that time, you should consider using a
documentation generator like <a class="reference external" href="http://sphinx-doc.org/">Sphinx</a> rather than the "header" and
"footer" directives.</p>
</div>
<p>In addition to the use of these directives to populate header and
footer content, content may also be added automatically by the
processing system. For example, if certain runtime settings are
enabled, the document footer is populated with processing information
such as a datestamp, a link to <a class="reference external" href="https://docutils.sourceforge.io">the Docutils website</a>, etc.</p>
</div>
</div>
<div class="section" id="references">
<h1><a class="toc-backref" href="#toc-entry-28">References</a></h1>
<div class="section" id="target-footnotes">
<span id="target-notes"></span><h2><a class="toc-backref" href="#toc-entry-29">Target Footnotes</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"target-notes"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Elements:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#pending">pending</a>, <a class="reference external" href="../doctree.html#footnote">footnote</a>, <a class="reference external" href="../doctree.html#footnote-reference">footnote_reference</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference internal" href="#class-1">class</a>, <a class="reference internal" href="#name">name</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">Possible (see below).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
</tbody>
</table>
<p>The "target-notes" directive creates a footnote for each external
target in the text, and corresponding footnote references after each
reference. For every explicit target (of the form, <tt class="docutils literal">.. _target name:
URL</tt>) in the text, a footnote will be generated containing the
visible URL as content.</p>
</div>
<div class="section" id="footnotes">
<h2><a class="toc-backref" href="#toc-entry-30">Footnotes</a></h2>
<p><strong>NOT IMPLEMENTED YET</strong></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"footnotes"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Elements:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#pending">pending</a>, <a class="reference external" href="../doctree.html#topic">topic</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">None?</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">Possible?</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
</tbody>
</table>
<p>@@@</p>
</div>
<div class="section" id="citations">
<h2><a class="toc-backref" href="#toc-entry-31">Citations</a></h2>
<p><strong>NOT IMPLEMENTED YET</strong></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"citations"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Elements:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#pending">pending</a>, <a class="reference external" href="../doctree.html#topic">topic</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">None?</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">Possible?</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
</tbody>
</table>
<p>@@@</p>
</div>
</div>
<div class="section" id="html-specific">
<h1><a class="toc-backref" href="#toc-entry-32">HTML-Specific</a></h1>
<div class="section" id="imagemap">
<h2><a class="toc-backref" href="#toc-entry-33">Imagemap</a></h2>
<p><strong>NOT IMPLEMENTED YET</strong></p>
<p>Non-standard element: imagemap.</p>
</div>
</div>
<div class="section" id="directives-for-substitution-definitions">
<h1><a class="toc-backref" href="#toc-entry-34">Directives for Substitution Definitions</a></h1>
<p>The directives in this section may only be used in <a class="reference external" href="restructuredtext.html#substitution-definitions">substitution
definitions</a>. They may not be used directly, in standalone context.
The <a class="reference external" href="../doctree.html#image">image</a> directive may be used both in substitution definitions
and in the standalone context.</p>
<div class="section" id="replacement-text">
<span id="replace"></span><h2><a class="toc-backref" href="#toc-entry-35">Replacement Text</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"replace"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body">Text & <a class="reference external" href="../doctree.html#inline-elements">inline elements</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">A single paragraph; may contain inline markup.</td>
</tr>
</tbody>
</table>
<p>The "replace" directive is used to indicate replacement text for a
substitution reference. It may be used within <a class="reference external" href="restructuredtext.html#substitution-definitions">substitution
definitions</a> only. For example, this directive can be used to expand
abbreviations:</p>
<pre class="literal-block">
.. |reST| replace:: reStructuredText
Yes, |reST| is a long word, so I can't blame anyone for wanting to
abbreviate it.
</pre>
<p>As reStructuredText doesn't support nested inline markup, the only way
to create a reference with styled text is to use substitutions with
the "replace" directive:</p>
<pre class="literal-block">
I recommend you try |Python|_.
.. |Python| replace:: Python, *the* best language around
.. _Python: https://www.python.org/
</pre>
</div>
<div class="section" id="unicode-character-codes">
<span id="unicode"></span><h2><a class="toc-backref" href="#toc-entry-36">Unicode Character Codes</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"unicode"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body">Text</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">One or more, required (Unicode character codes,
optional text, and comments).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">Possible (see below).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
</tbody>
</table>
<p>The "unicode" directive converts Unicode character codes (numerical
values) to characters, and may be used in <a class="reference external" href="restructuredtext.html#substitution-definitions">substitution definitions</a>
only.</p>
<p>The arguments, separated by spaces, can be:</p>
<ul class="simple">
<li><strong>character codes</strong> as<ul>
<li>decimal numbers or</li>
<li>hexadecimal numbers, prefixed by <tt class="docutils literal">0x</tt>, <tt class="docutils literal">x</tt>, <tt class="docutils literal">\x</tt>, <tt class="docutils literal">U+</tt>,
<tt class="docutils literal">u</tt>, or <tt class="docutils literal">\u</tt> or as XML-style hexadecimal character entities,
e.g. <tt class="docutils literal">&#x1a2b;</tt></li>
</ul>
</li>
<li><strong>text</strong>, which is used as-is.</li>
</ul>
<p>Text following " .. " is a comment and is ignored. The spaces between
the arguments are ignored and thus do not appear in the output.
Hexadecimal codes are case-insensitive.</p>
<p>For example, the following text:</p>
<pre class="literal-block">
Copyright |copy| 2003, |BogusMegaCorp (TM)| |---|
all rights reserved.
.. |copy| unicode:: 0xA9 .. copyright sign
.. |BogusMegaCorp (TM)| unicode:: BogusMegaCorp U+2122
.. with trademark sign
.. |---| unicode:: U+02014 .. em dash
:trim:
</pre>
<p>results in:</p>
<blockquote>
Copyright © 2003, BogusMegaCorp™—all rights reserved.</blockquote>
<p>The following options are recognized:</p>
<dl class="docutils">
<dt><tt class="docutils literal">ltrim</tt> <span class="classifier-delimiter">:</span> <span class="classifier">flag (empty)</span></dt>
<dd>Whitespace to the left of the substitution reference is removed.</dd>
<dt><tt class="docutils literal">rtrim</tt> <span class="classifier-delimiter">:</span> <span class="classifier">flag (empty)</span></dt>
<dd>Whitespace to the right of the substitution reference is removed.</dd>
<dt><tt class="docutils literal">trim</tt> <span class="classifier-delimiter">:</span> <span class="classifier">flag (empty)</span></dt>
<dd>Equivalent to <tt class="docutils literal">ltrim</tt> plus <tt class="docutils literal">rtrim</tt>; whitespace on both sides
of the substitution reference is removed.</dd>
</dl>
</div>
<div class="section" id="date">
<h2><a class="toc-backref" href="#toc-entry-37">Date</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"date"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body">Text</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">One, optional (date format).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
</tbody>
</table>
<p>The "date" directive generates the current local date and inserts it
into the document as text. This directive may be used in substitution
definitions only.</p>
<p>The optional directive content is interpreted as the desired date
format, using the same codes as Python's <a class="reference external" href="https://docs.python.org/3/library/time.html#time.strftime">time.strftime()</a> function. The
default format is "%Y-%m-%d" (ISO 8601 date), but time fields can also
be used. Examples:</p>
<pre class="literal-block">
.. |date| date::
.. |time| date:: %H:%M
Today's date is |date|.
This document was generated on |date| at |time|.
</pre>
</div>
</div>
<div class="section" id="miscellaneous">
<h1><a class="toc-backref" href="#toc-entry-38">Miscellaneous</a></h1>
<div class="section" id="including-an-external-document-fragment">
<span id="include"></span><h2><a class="toc-backref" href="#toc-entry-39">Including an External Document Fragment</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"include"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Elements:</th></tr>
<tr class="field"><td> </td><td class="field-body">Depend on data being included
(<a class="reference external" href="../doctree.html#literal-block">literal_block</a> with <tt class="docutils literal">code</tt> or <tt class="docutils literal">literal</tt> option).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">One, required (path to the file to include).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">Possible (see below).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Configuration Setting:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../../user/config.html#file-insertion-enabled">file_insertion_enabled</a></td>
</tr>
</tbody>
</table>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">The "include" directive represents a potential security hole. It
can be disabled with the "<a class="reference external" href="../../user/config.html#file-insertion-enabled">file_insertion_enabled</a>" runtime setting.</p>
</div>
<p>The "include" directive reads a text file. The directive argument is
the path to the file to be included, relative to the document containing
the directive. Unless the options <tt class="docutils literal">literal</tt>, <tt class="docutils literal">code</tt>, or <tt class="docutils literal">parser</tt>
are given, the file is parsed in the current document's context at the
point of the directive. For example:</p>
<pre class="literal-block">
This first example will be parsed at the document level, and can
thus contain any construct, including section headers.
.. include:: inclusion.txt
Back in the main document.
This second example will be parsed in a block quote context.
Therefore it may only contain body elements. It may not
contain section headers.
.. include:: inclusion.txt
</pre>
<p>If an included document fragment contains section structure, the title
adornments must match those of the master document.</p>
<p>Standard data files intended for inclusion in reStructuredText
documents are distributed with the Docutils source code, located in
the "docutils" package in the <tt class="docutils literal">docutils/parsers/rst/include</tt>
directory. To access these files, use the special syntax for standard
"include" data files, angle brackets around the file name:</p>
<pre class="literal-block">
.. include:: <isonum.txt>
</pre>
<p>The current set of standard "include" data files consists of sets of
substitution definitions. See <a class="reference external" href="definitions.html">reStructuredText Standard Definition
Files</a> for details.</p>
<p>The following options are recognized:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">start-line</span></tt> <span class="classifier-delimiter">:</span> <span class="classifier">integer</span></dt>
<dd>Only the content starting from this line will be included.
(As usual in Python, the first line has index 0 and negative values
count from the end.)</dd>
<dt><tt class="docutils literal"><span class="pre">end-line</span></tt> <span class="classifier-delimiter">:</span> <span class="classifier">integer</span></dt>
<dd>Only the content up to (but excluding) this line will be included.</dd>
<dt><tt class="docutils literal"><span class="pre">start-after</span></tt> <span class="classifier-delimiter">:</span> <span class="classifier">text to find in the external data file</span></dt>
<dd>Only the content after the first occurrence of the specified text
will be included.</dd>
<dt><tt class="docutils literal"><span class="pre">end-before</span></tt> <span class="classifier-delimiter">:</span> <span class="classifier">text to find in the external data file</span></dt>
<dd>Only the content before the first occurrence of the specified text
(but after any <tt class="docutils literal">after</tt> text) will be included.</dd>
<dt><tt class="docutils literal">parser</tt> <span class="classifier-delimiter">:</span> <span class="classifier">parser name</span></dt>
<dd>Parse the included content with the specified parser.
(New in Docutils 0.17)</dd>
<dt><tt class="docutils literal">literal</tt> <span class="classifier-delimiter">:</span> <span class="classifier">flag (empty)</span></dt>
<dd>The entire included text is inserted into the document as a single
literal block.</dd>
<dt><tt class="docutils literal">code</tt> <span class="classifier-delimiter">:</span> <span class="classifier">[string] (formal language)</span></dt>
<dd>The argument and the included content are passed to
the <a class="reference internal" href="#code">code</a> directive (useful for program listings).</dd>
<dt><tt class="docutils literal"><span class="pre">number-lines</span></tt> <span class="classifier-delimiter">:</span> <span class="classifier">[integer] (start line number)</span></dt>
<dd>Precede every code line with a line number.
The optional argument is the number of the first line (default 1).
Works only with <tt class="docutils literal">code</tt> or <tt class="docutils literal">literal</tt>.</dd>
<dt><tt class="docutils literal">encoding</tt> <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
<dd>The text encoding of the external data file. Defaults to the
document's <a class="reference external" href="../../user/config.html#input-encoding">input_encoding</a>.</dd>
<dt><tt class="docutils literal"><span class="pre">tab-width</span></tt> <span class="classifier-delimiter">:</span> <span class="classifier">integer</span></dt>
<dd>Number of spaces for hard tab expansion.
A negative value prevents expansion of hard tabs. Defaults to the
<a class="reference external" href="../../user/config.html#tab-width">tab_width</a> configuration setting.</dd>
</dl>
<p>With <tt class="docutils literal">code</tt> or <tt class="docutils literal">literal</tt> the common options <a class="reference internal" href="#class-1">class</a> and
<a class="reference internal" href="#name">name</a> are recognized as well.</p>
<p>Combining <tt class="docutils literal"><span class="pre">start/end-line</span></tt> and <tt class="docutils literal"><span class="pre">start-after/end-before</span></tt> is possible. The
text markers will be searched in the specified lines (further limiting the
included content).</p>
</div>
<div class="section" id="raw-data-pass-through">
<span id="raw-directive"></span><h2><a class="toc-backref" href="#toc-entry-40">Raw Data Pass-Through</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"raw"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#raw">raw</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">One or more, required (output format types).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">Possible (see below).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">Stored verbatim, uninterpreted. None (empty) if a
"file" or "url" option given.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Configuration Setting:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../../user/config.html#raw-enabled">raw_enabled</a></td>
</tr>
</tbody>
</table>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">The "raw" directive represents a potential security hole. It can
be disabled with the "<a class="reference external" href="../../user/config.html#raw-enabled">raw_enabled</a>" or "<a class="reference external" href="../../user/config.html#file-insertion-enabled">file_insertion_enabled</a>"
runtime settings.</p>
</div>
<div class="admonition caution">
<p class="first admonition-title">Caution!</p>
<p>The "raw" directive is a stop-gap measure allowing the author to
bypass reStructuredText's markup. It is a "power-user" feature
that should not be overused or abused. The use of "raw" ties
documents to specific output formats and makes them less portable.</p>
<p class="last">If you often need to use the "raw" directive or a "raw"-derived
interpreted text role, that is a sign either of overuse/abuse or
that functionality may be missing from reStructuredText. Please
describe your situation in a message to the <a class="reference external" href="../../user/mailing-lists.html#docutils-users">Docutils-users</a> mailing
list.</p>
</div>
<p>The "raw" directive indicates non-reStructuredText data that is to be
passed untouched to the Writer. The names of the output formats are
given in the directive arguments. The interpretation of the raw data
is up to the Writer. A Writer may ignore any raw output not matching
its format.</p>
<p>For example, the following input would be passed untouched by an HTML
writer:</p>
<pre class="literal-block">
.. raw:: html
<hr width=50 size=10>
</pre>
<p>A LaTeX Writer could insert the following raw content into its
output stream:</p>
<pre class="literal-block">
.. raw:: latex
\setlength{\parindent}{0pt}
</pre>
<p>Raw data can also be read from an external file, specified in a
directive option. In this case, the content block must be empty. For
example:</p>
<pre class="literal-block">
.. raw:: html
:file: inclusion.html
</pre>
<p>Inline equivalents of the "raw" directive can be defined via
<a class="reference internal" href="#custom-interpreted-text-roles">custom interpreted text roles</a> derived from the <a class="reference external" href="roles.html#raw">"raw" role</a>.</p>
<p>The following options are recognized:</p>
<dl class="docutils">
<dt><tt class="docutils literal">file</tt> <span class="classifier-delimiter">:</span> <span class="classifier">string (newlines removed)</span></dt>
<dd>The local filesystem path of a raw data file to be included.</dd>
<dt><tt class="docutils literal">url</tt> <span class="classifier-delimiter">:</span> <span class="classifier">string (whitespace removed)</span></dt>
<dd>An Internet URL reference to a raw data file to be included.</dd>
<dt><tt class="docutils literal">encoding</tt> <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
<dd>The text encoding of the external raw data (file or URL).
Defaults to the document's encoding (if specified).</dd>
</dl>
<p>and the common option <a class="reference internal" href="#class-1">class</a>.</p>
</div>
<div class="section" id="class">
<span id="classes"></span><h2><a class="toc-backref" href="#toc-entry-41">Class</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"class"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#pending">pending</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">One or more, required (class names / attribute
values).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">Optional. If present, it is interpreted as body
elements.</td>
</tr>
</tbody>
</table>
<p>The "class" directive sets the <a class="reference external" href="../doctree.html#classes">"classes"</a> attribute value on its content
or on the first immediately following <a class="footnote-reference" href="#footnote-4" id="footnote-reference-5">[5]</a> non-comment element <a class="footnote-reference" href="#footnote-5" id="footnote-reference-6">[6]</a>.
The directive argument consists of one or more space-separated class
names. The names are transformed to conform to the regular expression
<tt class="docutils literal"><span class="pre">[a-z](-?[a-z0-9]+)*</span></tt> (see <a class="reference internal" href="#identifier-normalization">Identifier Normalization</a> below).</p>
<p>Examples:</p>
<pre class="literal-block">
.. class:: special
This is a "special" paragraph.
.. class:: exceptional remarkable
An Exceptional Section
======================
This is an ordinary paragraph.
.. class:: multiple
First paragraph.
Second paragraph.
</pre>
<p>The text above is parsed and transformed into this doctree fragment:</p>
<pre class="literal-block">
<paragraph classes="special">
This is a "special" paragraph.
<section classes="exceptional remarkable">
<title>
An Exceptional Section
<paragraph>
This is an ordinary paragraph.
<paragraph classes="multiple">
First paragraph.
<paragraph classes="multiple">
Second paragraph.
</pre>
<table class="docutils footnote" frame="void" id="footnote-4" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#footnote-reference-5">[5]</a></td><td><p class="first">This is also true, if the class directive is "nested" at the end of
an indented text block, for example:</p>
<pre class="literal-block">
.. note:: the class values set in this directive-block do not apply to
the note but the next paragraph.
.. class:: special
This is a paragraph with class value "special".
</pre>
<p>This allows the "classification" of individual list items (except the
first, as a preceding class directive applies to the list as a whole):</p>
<pre class="last literal-block">
* bullet list
.. class:: classy item
* second item, with class argument
</pre>
</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="footnote-5" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#footnote-reference-6">[6]</a></td><td><p class="first">To set a "classes" attribute value on a block quote, the
"class" directive must be followed by an empty comment:</p>
<pre class="literal-block">
.. class:: highlights
..
Block quote text.
</pre>
<p class="last">Without the empty comment, the indented text would be interpreted as the
"class" directive's content, and the classes would be applied to each
element (paragraph, in this case) individually, instead of to the block
quote as a whole.</p>
</td></tr>
</tbody>
</table>
<div class="section" id="identifier-normalization">
<h3>Identifier Normalization</h3>
<p>Docutils <a class="reference external" href="../doctree.html#classnames-type">class names</a> and <a class="reference external" href="../doctree.html#ids-type">identifier keys</a> are normalized to conform
to the regular expression "<tt class="docutils literal"><span class="pre">[a-z](-?[a-z0-9]+)*</span></tt>" by converting</p>
<ul class="simple">
<li>alphabetic characters to lowercase,</li>
<li>accented characters to the base character,</li>
<li>non-alphanumeric characters to hyphens,</li>
<li>consecutive hyphens into one hyphen</li>
</ul>
<p>and stripping</p>
<ul class="simple">
<li>leading hyphens and number characters, and</li>
<li>trailing hyphens.</li>
</ul>
<p>For example <tt class="docutils literal"><span class="pre">"Rot.Gelb&Grün:+2008"</span></tt> becomes <tt class="docutils literal"><span class="pre">"rot-gelb-grun-2008"</span></tt> and
<tt class="docutils literal">"1000_Steps!"</tt> becomes <tt class="docutils literal">"steps"</tt>.</p>
<div class="topic">
<p class="topic-title">Rationale:</p>
<p>Identifier keys must be valid in all supported output formats.</p>
<p>For HTML 4.1 + CSS1 compatibility, identifiers should have no
underscores, colons, or periods. Hyphens may be used.</p>
<ul>
<li><p class="first">The <a class="reference external" href="https://www.w3.org/TR/html401/">HTML 4.01 spec</a> defines identifiers based on SGML tokens:</p>
<blockquote>
<p>ID and NAME tokens must begin with a letter ([A-Za-z]) and
may be followed by any number of letters, digits ([0-9]),
hyphens ("-"), underscores ("_"), colons (":"), and periods
(".").</p>
<p class="attribution">—<a class="reference external" href="https://www.w3.org/TR/html401/types.html#type-name">https://www.w3.org/TR/html401/types.html#type-name</a></p>
</blockquote>
</li>
<li><p class="first">The <a class="reference external" href="https://www.w3.org/TR/REC-CSS1">CSS1 spec</a> defines identifiers based on the "name" token
("flex" tokenizer notation below; "latin1" and "escape" 8-bit
characters have been replaced with XML entities):</p>
<pre class="literal-block">
unicode \\[0-9a-f]{1,4}
latin1 [&iexcl;-&yuml;]
escape {unicode}|\\[ -~&iexcl;-&yuml;]
nmchar [-A-Za-z0-9]|{latin1}|{escape}
name {nmchar}+
</pre>
</li>
</ul>
<p>The CSS1 rule requires underscores ("_"), colons (":"), and
periods (".") to be escaped <a class="footnote-reference" href="#footnote-6" id="footnote-reference-7">[7]</a>,
therefore <a class="reference external" href="../doctree.html#classes">"classes"</a> and <a class="reference external" href="../doctree.html#ids">"ids"</a> attributes should not
contain these characters. Combined with HTML4.1 requirements (the
first character must be a letter; no "unicode", "latin1", or
"escape" characters), this results in the regular expression
<tt class="docutils literal"><span class="pre">[A-Za-z][-A-Za-z0-9]*</span></tt>. Docutils adds a normalization by
downcasing and merge of consecutive hyphens.</p>
<table class="docutils footnote" frame="void" id="footnote-6" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#footnote-reference-7">[7]</a></td><td>CSS identifiers may use underscores ("_") directly in
<a class="reference external" href="https://www.w3.org/TR/CSS21/syndata.html#value-def-identifier">CSS Level 1</a>, <a class="reference external" href="https://www.w3.org/TR/CSS/#css-level-1">CSS2.1</a>, <a class="reference external" href="https://www.w3.org/TR/CSS22/syndata.html">CSS2.2</a>, and <a class="reference external" href="https://www.w3.org/TR/css-syntax-3/#typedef-ident-token">CSS3</a>.</td></tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="section" id="custom-interpreted-text-roles">
<span id="role"></span><h2><a class="toc-backref" href="#toc-entry-42">Custom Interpreted Text Roles</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"role"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body">None; affects subsequent parsing.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">Two; one required (new <a class="reference internal" href="#role-name">role name</a>), one optional
(base role name, in parentheses).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">Possible (depends on base role).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">depends on base role.</td>
</tr>
</tbody>
</table>
<p>The "role" directive dynamically creates a custom <a class="reference external" href="roles.html">interpreted text
role</a> and registers it with the parser. This means that after
declaring a role like this:</p>
<pre class="literal-block">
.. role:: custom
</pre>
<p>the document may use the new "custom" role:</p>
<pre class="literal-block">
An example of using :custom:`interpreted text`
</pre>
<p>This will be parsed into the following document tree fragment:</p>
<pre class="literal-block">
<paragraph>
An example of using
<inline classes="custom">
interpreted text
</pre>
<p>The role must be declared in a document before it can be used.</p>
<p id="role-name">Role names are case insensitive and must conform to the rules of
simple <a class="reference external" href="restructuredtext.html#reference-names">reference names</a> (but do not share a namespace with
hyperlinks, footnotes, and citations).</p>
<p>The new role may be based on an existing role, specified as a second
argument in parentheses (whitespace optional):</p>
<pre class="literal-block">
.. role:: custom(emphasis)
:custom:`text`
</pre>
<p>The parsed result is as follows:</p>
<pre class="literal-block">
<paragraph>
<emphasis classes="custom">
text
</pre>
<p>A special case is the <a class="reference external" href="roles.html#raw">"raw" role</a>: derived roles enable
inline <a class="reference internal" href="#raw-data-pass-through">raw data pass-through</a>, e.g.:</p>
<pre class="literal-block">
.. role:: raw-role(raw)
:format: html latex
:raw-role:`raw text`
</pre>
<p>If no base role is explicitly specified, a generic custom role is
automatically used. Subsequent interpreted text will produce an
"inline" element with a <a class="reference external" href="../doctree.html#classes">"classes"</a> attribute, as in the first example
above.</p>
<p>With most roles, the ":class:" option can be used to set a "classes"
attribute that is different from the role name. For example:</p>
<pre class="literal-block">
.. role:: custom
:class: special
:custom:`interpreted text`
</pre>
<p>This is the parsed result:</p>
<pre class="literal-block">
<paragraph>
<inline classes="special">
interpreted text
</pre>
<p id="role-class">The following option is recognized by the "role" directive for most
base roles:</p>
<dl class="docutils">
<dt><tt class="docutils literal">class</tt> <span class="classifier-delimiter">:</span> <span class="classifier">text</span></dt>
<dd>Set the <a class="reference external" href="../doctree.html#classes">"classes"</a> attribute value on the element produced
(<tt class="docutils literal">inline</tt>, or element associated with a base class) when the
custom interpreted text role is used. If no directive options are
specified, a "class" option with the directive argument (role
name) as the value is implied. See the <a class="reference internal" href="#class-1">class</a> directive above.</dd>
</dl>
<p>Specific base roles may support other options and/or directive
content. See the <a class="reference external" href="roles.html">reStructuredText Interpreted Text Roles</a> document
for details.</p>
</div>
<div class="section" id="setting-the-default-interpreted-text-role">
<span id="default-role"></span><h2><a class="toc-backref" href="#toc-entry-43">Setting the Default Interpreted Text Role</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"default-role"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body">None; affects subsequent parsing.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">One, optional (new default role name).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
</tbody>
</table>
<p>The "default-role" directive sets the default interpreted text role,
the role that is used for interpreted text without an explicit role.
For example, after setting the default role like this:</p>
<pre class="literal-block">
.. default-role:: subscript
</pre>
<p>any subsequent use of implicit-role interpreted text in the document
will use the "subscript" role:</p>
<pre class="literal-block">
An example of a `default` role.
</pre>
<p>This will be parsed into the following document tree fragment:</p>
<pre class="literal-block">
<paragraph>
An example of a
<subscript>
default
role.
</pre>
<p>Custom roles may be used (see the "<a class="reference internal" href="#role">role</a>" directive above), but it
must have been declared in a document before it can be set as the
default role. See the <a class="reference external" href="roles.html">reStructuredText Interpreted Text Roles</a>
document for details of built-in roles.</p>
<p>The directive may be used without an argument to restore the initial
default interpreted text role, which is application-dependent. The
initial default interpreted text role of the standard reStructuredText
parser is "title-reference".</p>
</div>
<div class="section" id="metadata">
<h2><a class="toc-backref" href="#toc-entry-44">Metadata</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"meta"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body"><a class="reference external" href="../doctree.html#meta">meta</a></td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">Must contain a flat field list.</td>
</tr>
</tbody>
</table>
<p>The "meta" directive is used to specify metadata<a class="footnote-reference" href="#footnote-7" id="footnote-reference-8">[8]</a> to be stored
in, e.g., <a class="reference external" href="https://html.spec.whatwg.org/multipage/semantics.html#the-meta-element">HTML meta elements</a> or as <a class="reference external" href="https://en.wikipedia.org/wiki/OpenDocument_technical_specification#Metadata">ODT file properties</a>. The
LaTeX writer passes it to the <tt class="docutils literal">pdfinfo</tt> option of the <a class="reference external" href="https://ctan.org/pkg/hyperref">hyperref</a>
package. If an output format does not support "invisible" metadata,
content is silently dropped by the writer.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>Data from some <a class="reference external" href="restructuredtext.html#bibliographic-fields">bibliographic fields</a> is automatically
extracted and stored as metadata, too. However, Bibliographic
Fields are also displayed in the document's screen rendering or
printout.</p>
<p class="last">For an "invisible" <em>document title</em>, see the <a class="reference internal" href="#metadata-document-title">metadata document
title</a> directive below.</p>
</div>
<p>Within the directive block, a flat field list provides the syntax for
metadata. The field name becomes the contents of the "name" attribute
of the META tag, and the field body (interpreted as a single string
without inline markup) becomes the contents of the "content"
attribute. For example:</p>
<pre class="literal-block">
.. meta::
:description: The reStructuredText plaintext markup language
:keywords: plaintext, markup language
</pre>
<p>This would be converted to the following HTML:</p>
<pre class="literal-block">
<meta name="description"
content="The reStructuredText plaintext markup language">
<meta name="keywords" content="plaintext, markup language">
</pre>
<p>Support for other META attributes ("http-equiv", "scheme", "lang",
"dir") are provided through field arguments, which must be of the form
"attr=value":</p>
<pre class="literal-block">
.. meta::
:description lang=en: An amusing story
:description lang=fr: Une histoire amusante
</pre>
<p>And their HTML equivalents:</p>
<pre class="literal-block">
<meta name="description" lang="en" content="An amusing story">
<meta name="description" lang="fr" content="Une histoire amusante">
</pre>
<p>Some META tags use an "http-equiv" attribute instead of the "name"
attribute. To specify "http-equiv" META tags, simply omit the name:</p>
<pre class="literal-block">
.. meta::
:http-equiv=Content-Type: text/html; charset=ISO-8859-1
</pre>
<p>HTML equivalent:</p>
<pre class="literal-block">
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1">
</pre>
<table class="docutils footnote" frame="void" id="footnote-7" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#footnote-reference-8">[8]</a></td><td>"Metadata" is data about data, in this case data about the
document. Metadata is, e.g., used to describe and classify web
pages in the World Wide Web, in a form that is easy for search
engines to extract and collate.</td></tr>
</tbody>
</table>
</div>
<div class="section" id="metadata-document-title">
<h2><a class="toc-backref" href="#toc-entry-45">Metadata Document Title</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"title"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body">Sets the document's <a class="reference external" href="../doctree.html#title-attribute">title attribute</a>.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">One, required (the title text).</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
</tbody>
</table>
<p>The "title" directive specifies the document title as metadata, which
does not become part of the document body. It overrides the
document-supplied <a class="reference external" href="restructuredtext.html#document-title">document title</a> and the <a class="reference external" href="../../user/config.html#title">"title" configuration
setting</a>. For example, in HTML output the metadata document title
appears in the title bar of the browser window.</p>
</div>
<div class="section" id="restructuredtext-test-directive">
<h2><a class="toc-backref" href="#toc-entry-46">Restructuredtext-Test-Directive</a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Directive Type:</th><td class="field-body">"restructuredtext-test-directive"</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Doctree Element:</th></tr>
<tr class="field"><td> </td><td class="field-body">system_warning</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Arguments:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Options:</th></tr>
<tr class="field"><td> </td><td class="field-body">None.</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Directive Content:</th></tr>
<tr class="field"><td> </td><td class="field-body">Interpreted as a literal block.</td>
</tr>
</tbody>
</table>
<p>This directive is provided for test purposes only. (Nobody is
expected to type in a name <em>that</em> long!) It is converted into a
level-1 (info) system message showing the directive data, possibly
followed by a literal block containing the rest of the directive
block.</p>
</div>
</div>
<div class="section" id="common-options">
<h1><a class="toc-backref" href="#toc-entry-47">Common Options</a></h1>
<p>Most of the directives that generate doctree elements support the following
options:</p>
<span id="class-option"></span><dl class="docutils" id="class-1">
<dt><tt class="docutils literal">class</tt> <span class="classifier-delimiter">:</span> <span class="classifier">text (space separated list of <a class="reference external" href="../doctree.html#classnames-type">class names</a>)</span></dt>
<dd>Set a <a class="reference external" href="../doctree.html#classes">"classes"</a> attribute value on the doctree element generated by
the directive. See also the <a class="reference internal" href="#class-1">class</a> directive.</dd>
<dt id="name"><tt class="docutils literal">name</tt> <span class="classifier-delimiter">:</span> <span class="classifier">text</span></dt>
<dd><p class="first">Add <cite>text</cite> to the <a class="reference external" href="../doctree.html#names">"names"</a> attribute of the doctree element generated
by the directive. This allows <a class="reference external" href="restructuredtext.html#hyperlink-references">hyperlink references</a> to the element
using <cite>text</cite> as <a class="reference external" href="restructuredtext.html#reference-names">reference name</a>.</p>
<p>Specifying the <cite>name</cite> option of a directive, e.g.,</p>
<pre class="literal-block">
.. image:: bild.png
:name: my picture
</pre>
<p>is a concise syntax alternative to preceding it with a <a class="reference external" href="restructuredtext.html#hyperlink-targets">hyperlink
target</a></p>
<pre class="last literal-block">
.. _my picture:
.. image:: bild.png
</pre>
</dd>
</dl>
<!-- Local Variables:
mode: indented-text
indent-tabs-mode: nil
sentence-end-double-space: t
fill-column: 70
End: -->
</div>
</div>
</body>
</html>