docutils
Standalone (default), PEP
reStructuredText (default), Markdown (requires 3rd party packages)
html, html4css1, html5 (default), latex2e, manpage, odt, pep_html, pseudo-xml, s5_html, xelatex, xml,
Since Docutils 0.19, you can start the generic front end like:
docutils test.rst > test.html
Alternatively, use Python's -m option, or the docutils-cli.py script in the tools/ directory.
The generic front end allows combining "reader", "parser", and "writer" components from the Docutils package or 3rd party plug-ins.
For example, to process a Markdown file "test.md" into Pseudo-XML:
docutils --parser=markdown --writer=pseudoxml test.md > test.rst
Another example is converting a reStructuredText PEP source into a HTML preview [2]:
docutils --reader=pep --writer=pep_html pep-0287.rst > pep-0287.html
The pep_html writer makes use of a "pep-html-template" file and the "pep.css" stylesheet (both in the docutils/writers/pep_html/ directory), but these can be overridden by command-line options or configuration files.
Use the "--help" option together with the component-selection options to get the correct list of supported command-line options. Example:
docutils --parser=markdown --writer=xml --helpHTML-Generating Tools rst2html
Standalone
reStructuredText
rst2html 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 html4css1, it will change to html5 in Docutils 2.0.
Caution!
Use a specific front end like rst2html4 or rst2html5, 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).
rst2html4Standalone
reStructuredText
The rst2html4 front end reads standalone reStructuredText source files and produces XHTML 1.0 Transitional output. A CSS stylesheet is required for proper rendering; a simple but complete stylesheet is installed and used by default (see Stylesheets below).
For example, to process a reStructuredText file "test.rst" into HTML:
rst2html test.rst > test.html
Now open the "test.html" 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:
rst2html --source-link --time --generator test.rst > test.htmlStylesheets
rst2html inserts into the generated HTML a cascading stylesheet (or a link to a stylesheet, when passing the "--link-stylesheet" option). A stylesheet is required for proper rendering. The default stylesheet (docutils/writers/html4css1/html4css1.css, located in the installation directory) is provided for basic use.
To use different stylesheet(s), specify the stylesheets' location(s) as comma-separated list with the "--stylesheet" or "--stylesheet-path" options. To experiment with styles, please see the guide to writing HTML (CSS) stylesheets for Docutils.
rst2html5Standalone
reStructuredText
The rst2html5 front end reads standalone reStructuredText source files and produces HTMLĂ‚ 5 output. Correct rendering of elements not directly supported by HTML depends on a CSS style sheet. The provided style sheets minimal.css and plain.css define required and optional styling rules respectively.
rst2s5Standalone
reStructuredText
The rst2s5 front end reads standalone reStructuredText source files and produces (X)HTML output compatible with S5, 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 Themes below.
For example, to process a reStructuredText file "slides.rst" into S5/HTML:
rst2s5 slides.rst --output=slides.html
Now open the "slides.html" file in your favourite browser, switch to full-screen mode, and enjoy the results.
ThemesEach S5 theme consists of a directory containing several files: stylesheets, JavaScript, and graphics. These are copied into a ui/<theme> directory beside the generated HTML. [3] A theme is chosen using the "--theme" option (for themes that come with Docutils) or the "--theme-url" option (for themes anywhere). For example, the "medium-black" theme can be specified as follows:
rst2s5 --theme medium-black slides.rst --output=slides.html
The theme will be copied [3] to the ui/medium-black directory.
Several themes are included with Docutils:
This is a simplified version of S5's default theme.
black serif text on a white background
about 13 lines
light blue, bold sans-serif text on a dark blue background; titles are limited to one line
small, gray, bold sans-serif text on a dark blue background
(Small text on a white background.)
black serif text on a white background
about 15 lines
black, bold sans-serif text on a white background; titles wrap
small, dark gray, bold sans-serif text on a white background
white serif text on a black background
about 15 lines
white, bold sans-serif text on a black background; titles wrap
small, light gray, bold sans-serif text on a black background
black serif text on a white background
about 9 lines
black, bold sans-serif text on a white background; titles wrap
small, dark gray, bold sans-serif text on a white background
white serif text on a black background
about 9 lines
white, bold sans-serif text on a black background; titles wrap
small, light gray, bold sans-serif text on a black background
black, bold sans-serif text on a white background
about 5 lines
black, bold sans-serif text on a white background; titles wrap
not displayed
white, bold sans-serif text on a black background
about 5 lines
white, bold sans-serif text on a black background; titles wrap
not displayed
If a theme directory contains a file named __base__, 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).
For details, please see Easy Slide Shows With reStructuredText & S5.
buildhtml.pyStandalone, PEP
reStructuredText
The buildhtml.py script can be found in the /tools directory of the "docutils" source. It is not included in binary packages. [4]
Usage:
buildhtml.py [options] [<directory> ...]
Use buildhtml.py to generate *.html 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 --local option to skip all subdirectories. See [buildhtml application] in Docutils Configuration for more specific selection options.
After unpacking the Docutils source package, you can cd into its root directory (docutils-X.Y/ where "X.Y" is the release version, for official releases) and generate HTML pages for all included documentation files with:
tools/buildhtml.py
Some files may generate system messages (docs/user/rst/demo.rst contains intentional errors); use the --quiet option to suppress all warnings.
LaTeX-Generating Tools rst2latexStandalone
reStructuredText
The rst2latex front end reads standalone reStructuredText source files and produces LaTeX output. For example, to process a reStructuredText file "test.rst" into LaTeX:
rst2latex test.rst > test.tex
The output file "test.tex" should then be processed with latex or pdflatex to get a document in DVI, PostScript or PDF format for printing or on-screen viewing.
For details see Generating LaTeX with Docutils.
rst2xetexStandalone
reStructuredText
xelatex
The rst2xetex front end reads standalone reStructuredText source files and produces LaTeX output for processing with Unicode-aware TeX engines (LuaTeX or XeTeX). For example, to process a reStructuredText file "test.rst" into LaTeX:
rst2xetex test.rst > test.tex
The output file "test.tex" should then be processed with xelatex or lualatex to get a document in PDF format for printing or on-screen viewing.
For details see Generating LaTeX with Docutils.
Man-Page-Generating Tools rst2manStandalone
reStructuredText
The rst2man front end reads standalone reStructuredText source files and produces troff sources for Unix man pages.
OpenDocument-Generating Tools rst2odtStandalone
reStructuredText
The rst2odt front end reads standalone reStructuredText source files and produces ODF/.odt files that can be read, edited, printed, etc with OpenOffice oowriter or LibreOffice lowriter. A stylesheet file is required. A stylesheet file is an OpenOffice .odt file containing definitions of the styles required for rst2odt. For details, see Odt Writer for Docutils.
reStructuredText-Generating ToolsCurrently, there is no reStructuredText writer in Docutils and therefore an rst2rst tool is still missing.
To generate reStructuredText documents with Docutils, you can use the XML (Docutils native) writer and the xml2rst processor.
XML-Generating Tools rst2xmlStandalone
reStructuredText
XML (Docutils native)
The rst2xml 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 xml2rst processor by Stefan Merten.
Testing/Debugging Tools rst2pseudoxmlStandalone
reStructuredText
Pseudo-XML
rst2pseudoxml 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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4