CINXE.COM
Docutils Front-End Tools
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta charset="utf-8" /> <meta name="generator" content="Docutils 0.22b.dev: https://docutils.sourceforge.io/" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="author" content="David Goodger" /> <meta name="dcterms.date" content="2024-08-15" /> <meta name="dcterms.rights" content="This document has been placed in the public domain." /> <title>Docutils Front-End Tools</title> <link rel="schema.dcterms" href="http://purl.org/dc/terms/"/> <link rel="stylesheet" href="../../docutils/writers/html5_polyglot/minimal.css" type="text/css" /> <link rel="stylesheet" href="../../docutils/writers/html5_polyglot/responsive.css" type="text/css" /> <link rel="stylesheet" href="../../docutils/writers/html5_polyglot/italic-field-names.css" type="text/css" /> </head> <body class="with-toc"> <header> <p><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></p> </header> <main id="docutils-front-end-tools"> <h1 class="title">Docutils Front-End Tools</h1> <dl class="docinfo"> <dt class="author">Author<span class="colon">:</span></dt> <dd class="author"><p>David Goodger</p></dd> <dt class="contact">Contact<span class="colon">:</span></dt> <dd class="contact"><a class="reference external" href="mailto:docutils-develop@lists.sourceforge.net">docutils-develop@lists.sourceforge.net</a></dd> <dt class="revision">Revision<span class="colon">:</span></dt> <dd class="revision">9906</dd> <dt class="date">Date<span class="colon">:</span></dt> <dd class="date">2024-08-15</dd> <dt class="copyright">Copyright<span class="colon">:</span></dt> <dd class="copyright">This document has been placed in the public domain.</dd> </dl> <!-- Minimal menu bar for inclusion in documentation sources in ``docutils/docs/*/`` sub-diretories. Attention: this is not a standalone document. --> <nav class="contents" id="contents" role="doc-toc"> <p class="topic-title"><a class="reference internal" href="#top">Contents</a></p> <ul class="simple"> <li><p><a class="reference internal" href="#introduction" id="toc-entry-1">Introduction</a></p> <ul> <li><p><a class="reference internal" href="#getting-help" id="toc-entry-2">Getting Help</a></p></li> </ul> </li> <li><p><a class="reference internal" href="#the-tools" id="toc-entry-3">The Tools</a></p> <ul> <li><p><a class="reference internal" href="#generic-command-line-front-end" id="toc-entry-4">Generic Command Line Front End</a></p> <ul> <li><p><a class="reference internal" href="#docutils" id="toc-entry-5">docutils</a></p></li> </ul> </li> <li><p><a class="reference internal" href="#html-generating-tools" id="toc-entry-6">HTML-Generating Tools</a></p> <ul> <li><p><a class="reference internal" href="#rst2html" id="toc-entry-7">rst2html</a></p></li> <li><p><a class="reference internal" href="#rst2html4" id="toc-entry-8">rst2html4</a></p> <ul> <li><p><a class="reference internal" href="#stylesheets" id="toc-entry-9">Stylesheets</a></p></li> </ul> </li> <li><p><a class="reference internal" href="#rst2html5" id="toc-entry-10">rst2html5</a></p></li> <li><p><a class="reference internal" href="#rst2s5" id="toc-entry-11">rst2s5</a></p> <ul> <li><p><a class="reference internal" href="#themes" id="toc-entry-12">Themes</a></p></li> </ul> </li> <li><p><a class="reference internal" href="#buildhtml-py" id="toc-entry-13">buildhtml.py</a></p></li> </ul> </li> <li><p><a class="reference internal" href="#latex-generating-tools" id="toc-entry-14">LaTeX-Generating Tools</a></p> <ul> <li><p><a class="reference internal" href="#rst2latex" id="toc-entry-15">rst2latex</a></p></li> <li><p><a class="reference internal" href="#rst2xetex" id="toc-entry-16">rst2xetex</a></p></li> </ul> </li> <li><p><a class="reference internal" href="#man-page-generating-tools" id="toc-entry-17">Man-Page-Generating Tools</a></p> <ul> <li><p><a class="reference internal" href="#rst2man" id="toc-entry-18">rst2man</a></p></li> </ul> </li> <li><p><a class="reference internal" href="#opendocument-generating-tools" id="toc-entry-19">OpenDocument-Generating Tools</a></p> <ul> <li><p><a class="reference internal" href="#rst2odt" id="toc-entry-20">rst2odt</a></p></li> </ul> </li> <li><p><a class="reference internal" href="#restructuredtext-generating-tools" id="toc-entry-21">reStructuredText-Generating Tools</a></p></li> <li><p><a class="reference internal" href="#xml-generating-tools" id="toc-entry-22">XML-Generating Tools</a></p> <ul> <li><p><a class="reference internal" href="#rst2xml" id="toc-entry-23">rst2xml</a></p></li> </ul> </li> <li><p><a class="reference internal" href="#testing-debugging-tools" id="toc-entry-24">Testing/Debugging Tools</a></p> <ul> <li><p><a class="reference internal" href="#rst2pseudoxml" id="toc-entry-25">rst2pseudoxml</a></p></li> </ul> </li> </ul> </li> <li><p><a class="reference internal" href="#customization" id="toc-entry-26">Customization</a></p> <ul> <li><p><a class="reference internal" href="#command-line-options" id="toc-entry-27">Command-Line Options</a></p></li> <li><p><a class="reference internal" href="#configuration-files" id="toc-entry-28">Configuration Files</a></p></li> </ul> </li> </ul> </nav> <section id="introduction"> <h2><a class="toc-backref" href="#toc-entry-1" role="doc-backlink">Introduction</a><a class="self-link" title="link to this section" href="#introduction"></a></h2> <p>In addition to the generic "<a class="reference internal" href="#docutils">docutils</a>" application, Docutils installs a set of small front ends, each specialized for a specific "Reader" (which knows how to interpret a file in context), "Parser" (which understands the syntax of the text), and "Writer" (which knows how to generate a specific data format).</p> <aside class="admonition note"> <p class="admonition-title">Note</p> <p>Docutils front-end tool names, install details and the set of auto-installed tools changed in Docutils聽0.21 (see the <a class="reference external" href="../../RELEASE-NOTES.html">RELEASE-NOTES</a>).</p> </aside> <p id="usage-pattern">Most <a class="brackets" href="#footnote-1" id="footnote-reference-1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a> front-end tools have common options and the same command-line usage pattern:</p> <pre class="literal-block"><toolname> [options] [<source> [<destination>]]</pre> <p>See <a class="reference internal" href="#the-tools">the tools</a> below for concrete examples.</p> <p>Each tool has a "<span class="docutils literal"><span class="pre">--help</span></span>" option which lists the <a class="reference internal" href="#command-line-options">command-line options</a> and arguments it supports. Processing can also be customized with <a class="reference internal" href="#configuration-files">configuration files</a>.</p> <p>The two arguments, "source" and "destination", are optional. If only one argument (source) is specified, the standard output (stdout) is used for the destination. If no arguments are specified, the standard input (stdin) is used for the source.</p> <aside class="footnote-list brackets"> <aside class="footnote brackets" id="footnote-1" role="doc-footnote"> <span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-1">1</a><span class="fn-bracket">]</span></span> <p>The exception is <a class="reference internal" href="#buildhtml-py">buildhtml.py</a>.</p> </aside> </aside> <aside class="admonition note"> <p class="admonition-title">Note</p> <p>The command line usage pattern will change over the next releases.</p> <p>See <a class="reference external" href="../../RELEASE-NOTES.html#future-changes">Future changes</a> in the RELEASE-NOTES.</p> </aside> <section id="getting-help"> <h3><a class="toc-backref" href="#toc-entry-2" role="doc-backlink">Getting Help</a><a class="self-link" title="link to this section" href="#getting-help"></a></h3> <p>First, try the "<span class="docutils literal"><span class="pre">--help</span></span>" option each front-end tool has.</p> <p>Command line options and their corresponding configuration file entries are detailed in <a class="reference external" href="config.html">Docutils Configuration</a>.</p> <p>Users who have questions or need assistance with Docutils or reStructuredText should post a message to the <a class="reference external" href="mailing-lists.html#docutils-users">Docutils-users</a> mailing list.</p> </section> </section> <section id="the-tools"> <h2><a class="toc-backref" href="#toc-entry-3" role="doc-backlink">The Tools</a><a class="self-link" title="link to this section" href="#the-tools"></a></h2> <section id="generic-command-line-front-end"> <h3><a class="toc-backref" href="#toc-entry-4" role="doc-backlink">Generic Command Line Front End</a><a class="self-link" title="link to this section" href="#generic-command-line-front-end"></a></h3> <section id="docutils"> <h4><a class="toc-backref" href="#toc-entry-5" role="doc-backlink">docutils</a><a class="self-link" title="link to this section" href="#docutils"></a></h4> <dl class="field-list simple"> <dt>CLI name<span class="colon">:</span></dt> <dd><p><span class="docutils literal">docutils</span></p> </dd> <dt>Readers<span class="colon">:</span></dt> <dd><p>Standalone (default), PEP</p> </dd> <dt>Parsers<span class="colon">:</span></dt> <dd><p>reStructuredText (default), Markdown (requires 3rd party packages)</p> </dd> <dt>Writers<span class="colon">:</span></dt> <dd><p><a class="reference external" href="html.html#html">html</a>, <a class="reference external" href="html.html#html4css1">html4css1</a>, <a class="reference external" href="html.html#html5">html5</a> (default), <a class="reference external" href="latex.html">latex2e</a>, <a class="reference external" href="manpage.html">manpage</a>, <a class="reference external" href="odt.html">odt</a>, <a class="reference external" href="html.html#pep-html">pep_html</a>, <a class="reference internal" href="#pseudo-xml">pseudo-xml</a>, <a class="reference external" href="html.html#s5-html">s5_html</a>, <a class="reference internal" href="#xelatex">xelatex</a>, <a class="reference internal" href="#xml">xml</a>,</p> </dd> <dt><a class="reference external" href="config.html#configuration-file-sections-entries">Config</a><span class="colon">:</span></dt> <dd><p><a class="reference external" href="config.html#docutils-application">[docutils application]</a></p> </dd> </dl> <p>Since Docutils 0.19, you can start the generic front end like:</p> <pre class="literal-block">docutils test.rst > test.html</pre> <p>Alternatively, use Python's <span class="docutils literal"><span class="pre">-m</span></span> option, or the <span class="docutils literal"><span class="pre">docutils-cli.py</span></span> script in the <span class="docutils literal">tools/</span> directory.</p> <p>The generic front end allows combining "reader", "parser", and "writer" components from the Docutils package or 3rd party plug-ins.</p> <p>For example, to process a <a class="reference external" href="https://www.markdownguide.org/">Markdown</a> file "<span class="docutils literal">test.md</span>" into <a class="reference internal" href="#pseudo-xml">Pseudo-XML</a>:</p> <pre class="literal-block">docutils --parser=markdown --writer=pseudoxml test.md > test.rst</pre> <p>Another example is converting a reStructuredText <a class="reference external" href="https://peps.python.org">PEP</a> source into a HTML preview <a class="brackets" href="#footnote-2" id="footnote-reference-2" role="doc-noteref"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></a>:</p> <pre class="literal-block">docutils --reader=pep --writer=pep_html pep-0287.rst > pep-0287.html</pre> <p>The <a class="reference external" href="html.html#pep-html">pep_html</a> writer makes use of a "<span class="docutils literal"><span class="pre">pep-html-template</span></span>" file and the "<span class="docutils literal">pep.css</span>" stylesheet (both in the <span class="docutils literal">docutils/writers/pep_html/</span> directory), but these can be overridden by command-line options or configuration files.</p> <p>Use the "--help" option together with the component-selection options to get the correct list of supported command-line options. Example:</p> <pre class="literal-block">docutils --parser=markdown --writer=xml --help</pre> <aside class="footnote-list brackets"> <aside class="footnote brackets" id="footnote-2" role="doc-footnote"> <span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-2">2</a><span class="fn-bracket">]</span></span> <p>The rendering of published PEPs is done by a Sphinx-based build system (see <a class="reference external" href="https://peps.python.org/pep-0676">PEP 676</a>).</p> </aside> </aside> </section> </section> <section id="html-generating-tools"> <h3><a class="toc-backref" href="#toc-entry-6" role="doc-backlink">HTML-Generating Tools</a><a class="self-link" title="link to this section" href="#html-generating-tools"></a></h3> <section id="rst2html"> <span id="rst2html-py"></span><h4><a class="toc-backref" href="#toc-entry-7" role="doc-backlink">rst2html</a><a class="self-link" title="link to this section" href="#rst2html"></a></h4> <dl class="field-list simple"> <dt>Reader<span class="colon">:</span></dt> <dd><p>Standalone</p> </dd> <dt>Parser<span class="colon">:</span></dt> <dd><p>reStructuredText</p> </dd> <dt>Writer<span class="colon">:</span></dt> <dd><p><a class="reference external" href="html.html#html">html</a></p> </dd> </dl> <p><span class="docutils literal">rst2html</span> is the front-end for the default Docutils HTML writer. The default writer may change with the development of HTML, browsers, Docutils, and the web. The current default is <a class="reference external" href="html.html#html4css1">html4css1</a>, it will change to <a class="reference external" href="html.html#html5">html5</a> in Docutils聽2.0.</p> <aside class="admonition caution"> <p class="admonition-title">Caution!</p> <p>Use a specific front end like <a class="reference internal" href="#rst2html4">rst2html4</a> or <a class="reference internal" href="#rst2html5">rst2html5</a>, if you depend on stability of the generated HTML code (e.g., because you use a custom style sheet or post-processing that may break otherwise).</p> </aside> </section> <section id="rst2html4"> <span id="rst2html4-py"></span><h4><a class="toc-backref" href="#toc-entry-8" role="doc-backlink">rst2html4</a><a class="self-link" title="link to this section" href="#rst2html4"></a></h4> <dl class="field-list simple"> <dt>Reader<span class="colon">:</span></dt> <dd><p>Standalone</p> </dd> <dt>Parser<span class="colon">:</span></dt> <dd><p>reStructuredText</p> </dd> <dt>Writer<span class="colon">:</span></dt> <dd><p><a class="reference external" href="html.html#html4css1">html4css1</a></p> </dd> </dl> <p>The <span class="docutils literal">rst2html4</span> front end reads standalone reStructuredText source files and produces <a class="reference external" href="https://www.w3.org/TR/xhtml1/">XHTML 1.0 Transitional</a> output. A CSS stylesheet is required for proper rendering; a simple but complete stylesheet is installed and used by default (see <a class="reference internal" href="#stylesheets">Stylesheets</a> below).</p> <p>For example, to process a reStructuredText file "<span class="docutils literal">test.rst</span>" into HTML:</p> <pre class="literal-block">rst2html test.rst > test.html</pre> <p>Now open the "<span class="docutils literal">test.html</span>" file in your favourite browser to see the results. To get a footer with a link to the source file, date & time of processing, and links to the Docutils project, add some options:</p> <pre class="literal-block">rst2html --source-link --time --generator test.rst > test.html</pre> <section id="stylesheets"> <h5><a class="toc-backref" href="#toc-entry-9" role="doc-backlink">Stylesheets</a><a class="self-link" title="link to this section" href="#stylesheets"></a></h5> <p><span class="docutils literal">rst2html</span> inserts into the generated HTML a cascading stylesheet (or a link to a stylesheet, when passing the "<span class="docutils literal"><span class="pre">--link-stylesheet</span></span>" option). A stylesheet is required for proper rendering. The default stylesheet (<span class="docutils literal">docutils/writers/html4css1/html4css1.css</span>, located in the installation directory) is provided for basic use.</p> <p>To use different stylesheet(s), specify the stylesheets' location(s) as comma-separated list with the "<a class="reference external" href="config.html#stylesheet">--stylesheet</a>" or "<a class="reference external" href="config.html#stylesheet-path">--stylesheet-path</a>" options. To experiment with styles, please see the <a class="reference external" href="../howto/html-stylesheets.html">guide to writing HTML (CSS) stylesheets for Docutils</a>.</p> </section> </section> <section id="rst2html5"> <span id="rst2html5-py"></span><h4><a class="toc-backref" href="#toc-entry-10" role="doc-backlink">rst2html5</a><a class="self-link" title="link to this section" href="#rst2html5"></a></h4> <dl class="field-list simple"> <dt>Reader<span class="colon">:</span></dt> <dd><p>Standalone</p> </dd> <dt>Parser<span class="colon">:</span></dt> <dd><p>reStructuredText</p> </dd> <dt>Writer<span class="colon">:</span></dt> <dd><p><a class="reference external" href="html.html#html5">html5</a></p> </dd> </dl> <p>The <span class="docutils literal">rst2html5</span> front end reads standalone reStructuredText source files and produces <a class="reference external" href="https://www.w3.org/TR/html5/">HTML聽5</a> output. Correct rendering of elements not directly supported by HTML depends on a CSS style sheet. The provided style sheets <span class="docutils literal">minimal.css</span> and <span class="docutils literal">plain.css</span> define required and optional styling rules respectively.</p> </section> <section id="rst2s5"> <span id="rst2s5-py"></span><h4><a class="toc-backref" href="#toc-entry-11" role="doc-backlink">rst2s5</a><a class="self-link" title="link to this section" href="#rst2s5"></a></h4> <dl class="field-list simple"> <dt>Reader<span class="colon">:</span></dt> <dd><p>Standalone</p> </dd> <dt>Parser<span class="colon">:</span></dt> <dd><p>reStructuredText</p> </dd> <dt>Writer<span class="colon">:</span></dt> <dd><p><a class="reference external" href="html.html#s5-html">s5_html</a></p> </dd> </dl> <p>The <span class="docutils literal">rst2s5</span> front end reads standalone reStructuredText source files and produces (X)HTML output compatible with <a class="reference external" href="http://meyerweb.com/eric/tools/s5/">S5</a>, the "Simple Standards-based Slide Show System" by Eric Meyer. A theme is required for proper rendering; several are distributed with Docutils and others are available; see <a class="reference internal" href="#themes">Themes</a> below.</p> <p>For example, to process a reStructuredText file "<span class="docutils literal">slides.rst</span>" into S5/HTML:</p> <pre class="literal-block">rst2s5 slides.rst --output=slides.html</pre> <p>Now open the "<span class="docutils literal">slides.html</span>" file in your favourite browser, switch to full-screen mode, and enjoy the results.</p> <section id="themes"> <h5><a class="toc-backref" href="#toc-entry-12" role="doc-backlink">Themes</a><a class="self-link" title="link to this section" href="#themes"></a></h5> <p>Each S5 theme consists of a directory containing several files: stylesheets, JavaScript, and graphics. These are copied into a <span class="docutils literal"><span class="pre">ui/<theme></span></span> directory beside the generated HTML. <a class="brackets" href="#copy-theme" id="footnote-reference-3" role="doc-noteref"><span class="fn-bracket">[</span>3<span class="fn-bracket">]</span></a> A theme is chosen using the "<span class="docutils literal"><span class="pre">--theme</span></span>" option (for themes that come with Docutils) or the "<span class="docutils literal"><span class="pre">--theme-url</span></span>" option (for themes anywhere). For example, the "medium-black" theme can be specified as follows:</p> <pre class="literal-block">rst2s5 --theme medium-black slides.rst --output=slides.html</pre> <p>The theme will be copied <a class="brackets" href="#copy-theme" id="footnote-reference-4" role="doc-noteref"><span class="fn-bracket">[</span>3<span class="fn-bracket">]</span></a> to the <span class="docutils literal"><span class="pre">ui/medium-black</span></span> directory.</p> <p>Several themes are included with Docutils:</p> <dl class="simple"> <dt><span class="docutils literal">default</span></dt> <dd><p>This is a simplified version of S5's default theme.</p> <dl class="field-list simple"> <dt>Main content<span class="colon">:</span></dt> <dd><p>black serif text on a white background</p> </dd> <dt>Text capacity<span class="colon">:</span></dt> <dd><p>about 13 lines</p> </dd> <dt>Headers<span class="colon">:</span></dt> <dd><p>light blue, bold sans-serif text on a dark blue background; titles are limited to one line</p> </dd> <dt>Footers<span class="colon">:</span></dt> <dd><p>small, gray, bold sans-serif text on a dark blue background</p> </dd> </dl> </dd> <dt><span class="docutils literal"><span class="pre">small-white</span></span></dt> <dd><p>(Small text on a white background.)</p> <dl class="field-list simple"> <dt>Main content<span class="colon">:</span></dt> <dd><p>black serif text on a white background</p> </dd> <dt>Text capacity<span class="colon">:</span></dt> <dd><p>about 15 lines</p> </dd> <dt>Headers<span class="colon">:</span></dt> <dd><p>black, bold sans-serif text on a white background; titles wrap</p> </dd> <dt>Footers<span class="colon">:</span></dt> <dd><p>small, dark gray, bold sans-serif text on a white background</p> </dd> </dl> </dd> <dt><span class="docutils literal"><span class="pre">small-black</span></span></dt> <dd><dl class="field-list simple"> <dt>Main content<span class="colon">:</span></dt> <dd><p>white serif text on a black background</p> </dd> <dt>Text capacity<span class="colon">:</span></dt> <dd><p>about 15 lines</p> </dd> <dt>Headers<span class="colon">:</span></dt> <dd><p>white, bold sans-serif text on a black background; titles wrap</p> </dd> <dt>Footers<span class="colon">:</span></dt> <dd><p>small, light gray, bold sans-serif text on a black background</p> </dd> </dl> </dd> <dt><span class="docutils literal"><span class="pre">medium-white</span></span></dt> <dd><dl class="field-list simple"> <dt>Main content<span class="colon">:</span></dt> <dd><p>black serif text on a white background</p> </dd> <dt>Text capacity<span class="colon">:</span></dt> <dd><p>about 9 lines</p> </dd> <dt>Headers<span class="colon">:</span></dt> <dd><p>black, bold sans-serif text on a white background; titles wrap</p> </dd> <dt>Footers<span class="colon">:</span></dt> <dd><p>small, dark gray, bold sans-serif text on a white background</p> </dd> </dl> </dd> <dt><span class="docutils literal"><span class="pre">medium-black</span></span></dt> <dd><dl class="field-list simple"> <dt>Main content<span class="colon">:</span></dt> <dd><p>white serif text on a black background</p> </dd> <dt>Text capacity<span class="colon">:</span></dt> <dd><p>about 9 lines</p> </dd> <dt>Headers<span class="colon">:</span></dt> <dd><p>white, bold sans-serif text on a black background; titles wrap</p> </dd> <dt>Footers<span class="colon">:</span></dt> <dd><p>small, light gray, bold sans-serif text on a black background</p> </dd> </dl> </dd> <dt><span class="docutils literal"><span class="pre">big-white</span></span></dt> <dd><dl class="field-list simple"> <dt>Main content<span class="colon">:</span></dt> <dd><p>black, bold sans-serif text on a white background</p> </dd> <dt>Text capacity<span class="colon">:</span></dt> <dd><p>about 5 lines</p> </dd> <dt>Headers<span class="colon">:</span></dt> <dd><p>black, bold sans-serif text on a white background; titles wrap</p> </dd> <dt>Footers<span class="colon">:</span></dt> <dd><p>not displayed</p> </dd> </dl> </dd> <dt><span class="docutils literal"><span class="pre">big-black</span></span></dt> <dd><dl class="field-list simple"> <dt>Main content<span class="colon">:</span></dt> <dd><p>white, bold sans-serif text on a black background</p> </dd> <dt>Text capacity<span class="colon">:</span></dt> <dd><p>about 5 lines</p> </dd> <dt>Headers<span class="colon">:</span></dt> <dd><p>white, bold sans-serif text on a black background; titles wrap</p> </dd> <dt>Footers<span class="colon">:</span></dt> <dd><p>not displayed</p> </dd> </dl> </dd> </dl> <p>If a theme directory contains a file named <span class="docutils literal">__base__</span>, the name of the theme's base theme will be read from it. Files are accumulated from the named theme, any base themes, and the "default" theme (which is the implicit base of all themes).</p> <p>For details, please see <a class="reference external" href="slide-shows.html">Easy Slide Shows With reStructuredText & S5</a>.</p> <aside class="footnote-list brackets"> <aside class="footnote brackets" id="copy-theme" role="doc-footnote"> <span class="label"><span class="fn-bracket">[</span>3<span class="fn-bracket">]</span></span> <span class="backrefs">(<a role="doc-backlink" href="#footnote-reference-3">1</a>,<a role="doc-backlink" href="#footnote-reference-4">2</a>)</span> <p>Theme files can only be copied by Docutils, if the <a class="reference external" href="config.html#output">output</a> destination path is specified.</p> </aside> </aside> </section> </section> <section id="buildhtml-py"> <h4><a class="toc-backref" href="#toc-entry-13" role="doc-backlink">buildhtml.py</a><a class="self-link" title="link to this section" href="#buildhtml-py"></a></h4> <dl class="field-list simple"> <dt>Readers<span class="colon">:</span></dt> <dd><p>Standalone, PEP</p> </dd> <dt>Parser<span class="colon">:</span></dt> <dd><p>reStructuredText</p> </dd> <dt>Writers<span class="colon">:</span></dt> <dd><p><a class="reference external" href="html.html#html">html</a>, <a class="reference external" href="html.html#html5">html5</a>, <a class="reference external" href="html.html#pep-html">pep_html</a></p> </dd> <dt><a class="reference external" href="config.html#configuration-file-sections-entries">Config</a><span class="colon">:</span></dt> <dd><p><a class="reference external" href="config.html#buildhtml-application">[buildhtml application]</a></p> </dd> </dl> <p>The <span class="docutils literal">buildhtml.py</span> script can be found in the <span class="docutils literal">/tools</span> directory of the "docutils" source. It is not included in binary packages. <a class="brackets" href="#footnote-3" id="footnote-reference-5" role="doc-noteref"><span class="fn-bracket">[</span>4<span class="fn-bracket">]</span></a></p> <p>Usage:</p> <pre class="literal-block">buildhtml.py [options] [<directory> ...]</pre> <p>Use <span class="docutils literal">buildhtml.py</span> to generate <span class="docutils literal">*.html</span> from reStructuredText source files in each <directory> given, and their subdirectories too. The current directory is chosen by default if no directory is specified. Use the <span class="docutils literal"><span class="pre">--local</span></span> option to skip all subdirectories. See <a class="reference external" href="config.html#buildhtml-application">[buildhtml application]</a> in <a class="reference external" href="config.html">Docutils Configuration</a> for more specific selection options.</p> <p>After unpacking the Docutils source package, you can <span class="docutils literal">cd</span> into its root directory (<span class="docutils literal"><span class="pre">docutils-X.Y/</span></span> where "X.Y" is the release version, for official releases) and generate HTML pages for all included documentation files with:</p> <pre class="literal-block">tools/buildhtml.py</pre> <p>Some files may generate system messages (docs/user/rst/demo.rst contains intentional errors); use the <span class="docutils literal"><span class="pre">--quiet</span></span> option to suppress all warnings.</p> <aside class="footnote-list brackets"> <aside class="footnote brackets" id="footnote-3" role="doc-footnote"> <span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#footnote-reference-5">4</a><span class="fn-bracket">]</span></span> <p>The Debian package "python3-docutils" includes the script under the name <span class="docutils literal"><span class="pre">rst-buildhtml</span></span>.</p> </aside> </aside> </section> </section> <section id="latex-generating-tools"> <h3><a class="toc-backref" href="#toc-entry-14" role="doc-backlink">LaTeX-Generating Tools</a><a class="self-link" title="link to this section" href="#latex-generating-tools"></a></h3> <section id="rst2latex"> <span id="rst2latex-py"></span><h4><a class="toc-backref" href="#toc-entry-15" role="doc-backlink">rst2latex</a><a class="self-link" title="link to this section" href="#rst2latex"></a></h4> <dl class="field-list simple"> <dt>Reader<span class="colon">:</span></dt> <dd><p>Standalone</p> </dd> <dt>Parser<span class="colon">:</span></dt> <dd><p>reStructuredText</p> </dd> <dt>Writer<span class="colon">:</span></dt> <dd><p><a class="reference external" href="latex.html">latex2e</a></p> </dd> </dl> <p>The <span class="docutils literal">rst2latex</span> front end reads standalone reStructuredText source files and produces <a class="reference external" href="https://en.wikipedia.org/wiki/LaTeX">LaTeX</a> output. For example, to process a reStructuredText file "<span class="docutils literal">test.rst</span>" into LaTeX:</p> <pre class="literal-block">rst2latex test.rst > test.tex</pre> <p>The output file "<span class="docutils literal">test.tex</span>" should then be processed with <span class="docutils literal">latex</span> or <span class="docutils literal">pdflatex</span> to get a document in DVI, PostScript or PDF format for printing or on-screen viewing.</p> <p>For details see <a class="reference external" href="latex.html">Generating LaTeX with Docutils</a>.</p> </section> <section id="rst2xetex"> <span id="rst2xetex-py"></span><h4><a class="toc-backref" href="#toc-entry-16" role="doc-backlink">rst2xetex</a><a class="self-link" title="link to this section" href="#rst2xetex"></a></h4> <dl class="field-list simple"> <dt>Reader<span class="colon">:</span></dt> <dd><p>Standalone</p> </dd> <dt>Parser<span class="colon">:</span></dt> <dd><p>reStructuredText</p> </dd> <dt>Writer<span class="colon">:</span></dt> <dd><p><span class="target" id="xelatex">xelatex</span></p> </dd> </dl> <p>The <span class="docutils literal">rst2xetex</span> front end reads standalone reStructuredText source files and produces <cite>LaTeX</cite> output for processing with Unicode-aware TeX engines (<a class="reference external" href="https://en.wikipedia.org/wiki/LuaTeX">LuaTeX</a> or <a class="reference external" href="https://en.wikipedia.org/wiki/XeTeX">XeTeX</a>). For example, to process a reStructuredText file "<span class="docutils literal">test.rst</span>" into LaTeX:</p> <pre class="literal-block">rst2xetex test.rst > test.tex</pre> <p>The output file "<span class="docutils literal">test.tex</span>" should then be processed with <span class="docutils literal">xelatex</span> or <span class="docutils literal">lualatex</span> to get a document in PDF format for printing or on-screen viewing.</p> <p>For details see <a class="reference external" href="latex.html">Generating LaTeX with Docutils</a>.</p> </section> </section> <section id="man-page-generating-tools"> <h3><a class="toc-backref" href="#toc-entry-17" role="doc-backlink">Man-Page-Generating Tools</a><a class="self-link" title="link to this section" href="#man-page-generating-tools"></a></h3> <section id="rst2man"> <span id="rst2man-py"></span><h4><a class="toc-backref" href="#toc-entry-18" role="doc-backlink">rst2man</a><a class="self-link" title="link to this section" href="#rst2man"></a></h4> <dl class="field-list simple"> <dt>Reader<span class="colon">:</span></dt> <dd><p>Standalone</p> </dd> <dt>Parser<span class="colon">:</span></dt> <dd><p>reStructuredText</p> </dd> <dt>Writer<span class="colon">:</span></dt> <dd><p><a class="reference external" href="manpage.html">manpage</a></p> </dd> </dl> <p>The <span class="docutils literal">rst2man</span> front end reads standalone reStructuredText source files and produces <a class="reference external" href="https://troff.org/">troff</a> sources for Unix man pages.</p> </section> </section> <section id="opendocument-generating-tools"> <h3><a class="toc-backref" href="#toc-entry-19" role="doc-backlink">OpenDocument-Generating Tools</a><a class="self-link" title="link to this section" href="#opendocument-generating-tools"></a></h3> <section id="rst2odt"> <span id="rst2odt-py"></span><h4><a class="toc-backref" href="#toc-entry-20" role="doc-backlink">rst2odt</a><a class="self-link" title="link to this section" href="#rst2odt"></a></h4> <dl class="field-list simple"> <dt>Reader<span class="colon">:</span></dt> <dd><p>Standalone</p> </dd> <dt>Parser<span class="colon">:</span></dt> <dd><p>reStructuredText</p> </dd> <dt>Writer<span class="colon">:</span></dt> <dd><p><a class="reference external" href="odt.html">odt</a></p> </dd> </dl> <p>The <span class="docutils literal">rst2odt</span> front end reads standalone reStructuredText source files and produces ODF/.odt files that can be read, edited, printed, etc with <a class="reference external" href="https://www.openoffice.org/">OpenOffice</a> <span class="docutils literal">oowriter</span> or <a class="reference external" href="https://www.libreoffice.org/">LibreOffice</a> <span class="docutils literal">lowriter</span>. A stylesheet file is required. A stylesheet file is an OpenOffice .odt file containing definitions of the styles required for <span class="docutils literal">rst2odt</span>. For details, see <a class="reference external" href="odt.html">Odt Writer for Docutils</a>.</p> </section> </section> <section id="restructuredtext-generating-tools"> <h3><a class="toc-backref" href="#toc-entry-21" role="doc-backlink">reStructuredText-Generating Tools</a><a class="self-link" title="link to this section" href="#restructuredtext-generating-tools"></a></h3> <p>Currently, there is no reStructuredText writer in Docutils and therefore an <span class="docutils literal">rst2rst</span> tool is still missing.</p> <p>To generate reStructuredText documents with Docutils, you can use the XML (Docutils native) writer and the <a class="reference external" href="http://www.merten-home.de/FreeSoftware/xml2rst/index.html">xml2rst</a> processor.</p> </section> <section id="xml-generating-tools"> <h3><a class="toc-backref" href="#toc-entry-22" role="doc-backlink">XML-Generating Tools</a><a class="self-link" title="link to this section" href="#xml-generating-tools"></a></h3> <section id="rst2xml"> <span id="rst2xml-py"></span><h4><a class="toc-backref" href="#toc-entry-23" role="doc-backlink">rst2xml</a><a class="self-link" title="link to this section" href="#rst2xml"></a></h4> <dl class="field-list simple"> <dt>Reader<span class="colon">:</span></dt> <dd><p>Standalone</p> </dd> <dt>Parser<span class="colon">:</span></dt> <dd><p>reStructuredText</p> </dd> <dt>Writer<span class="colon">:</span></dt> <dd><p><span class="target" id="xml">XML</span> (Docutils native)</p> </dd> </dl> <p>The <span class="docutils literal">rst2xml</span> front end produces Docutils-native XML output. This can be transformed with standard XML tools such as XSLT processors into arbitrary final forms. An example is the <a class="reference external" href="http://www.merten-home.de/FreeSoftware/xml2rst/index.html">xml2rst</a> processor by Stefan Merten.</p> </section> </section> <section id="testing-debugging-tools"> <h3><a class="toc-backref" href="#toc-entry-24" role="doc-backlink">Testing/Debugging Tools</a><a class="self-link" title="link to this section" href="#testing-debugging-tools"></a></h3> <section id="rst2pseudoxml"> <span id="rst2pseudoxml-py"></span><h4><a class="toc-backref" href="#toc-entry-25" role="doc-backlink">rst2pseudoxml</a><a class="self-link" title="link to this section" href="#rst2pseudoxml"></a></h4> <dl class="field-list simple"> <dt>Reader<span class="colon">:</span></dt> <dd><p>Standalone</p> </dd> <dt>Parser<span class="colon">:</span></dt> <dd><p>reStructuredText</p> </dd> <dt>Writer<span class="colon">:</span></dt> <dd><p><span class="target" id="pseudo-xml">Pseudo-XML</span></p> </dd> </dl> <p><span class="docutils literal">rst2pseudoxml</span> is used for debugging the Docutils "Reader to Transform to Writer" pipeline. It produces a compact pretty-printed "pseudo-XML", where nesting is indicated by indentation (no end-tags). External attributes for all elements are output, and internal attributes for any leftover "pending" elements are also given.</p> </section> </section> </section> <section id="customization"> <h2><a class="toc-backref" href="#toc-entry-26" role="doc-backlink">Customization</a><a class="self-link" title="link to this section" href="#customization"></a></h2> <p>All front-end tools support the options/settings from the generic <a class="reference external" href="config.html#configuration-file-sections-entries">configuration file sections</a> plus the sections of their components (reader, writer, parser). Some front-end tools also add application-specific settings.</p> <section id="command-line-options"> <h3><a class="toc-backref" href="#toc-entry-27" role="doc-backlink">Command-Line Options</a><a class="self-link" title="link to this section" href="#command-line-options"></a></h3> <p>Command-line options are intended for one-off customization. They take priority over configuration file settings.</p> <p>Use the <span class="docutils literal"><span class="pre">--help</span></span> option on each of the front ends to list the command-line options it supports.</p> </section> <section id="configuration-files"> <h3><a class="toc-backref" href="#toc-entry-28" role="doc-backlink">Configuration Files</a><a class="self-link" title="link to this section" href="#configuration-files"></a></h3> <p>Configuration files are used for persistent customization; they can be set once and take effect every time you use a front-end tool.</p> <p>Command-line options and their corresponding configuration file entry names are listed in the <a class="reference external" href="config.html">Docutils Configuration</a> document.</p> <!-- Emacs settings Local Variables: mode: indented-text mode: rst indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: --> </section> </section> </main> <footer> <p><a class="reference external" href="tools.rst">View document source</a>. Generated on: 2024-08-15 08:45 UTC. Generated by <a class="reference external" href="https://docutils.sourceforge.io/">Docutils</a> from <a class="reference external" href="https://docutils.sourceforge.io/rst.html">reStructuredText</a> source. </p> </footer> </body> </html>