Introduction
reStructuredText is a plain text markup language from the Docutils project, released in 2002 for Python documentation. Like Markdown it stays readable as written, but it is more strictly defined and can be extended with directives, which makes it suited to large technical manuals. It is the default language of the Sphinx documentation generator, which builds the documentation of Python itself and of many other projects.
Structure
An RST file is plain text, normally UTF-8. A
heading is a line of text
underlined, and optionally overlined, with a row of punctuation such as
= or -; the order in which styles first appear sets the
heading levels. The full syntax is on three pages:
sections and body elements,
inline markup and
directives and roles.
*text* and **text** give emphasis, double backticks mark
code, and lists start with -, * or numbers. Directives start
with two dots and end with two colons, such as .. note:: or
.. image:: photo.png, and roles such as :ref:`intro` mark text
inline. Indentation shows what belongs to a directive or list item.
Installation
============
Run the installer, then check the version:
.. code-block:: console
$ tool --version
.. note::
You need **administrator** rights on Windows.
Not described
The pages cover the Docutils reStructuredText specification, including every standard directive and role.
Known, not yet covered
- Reference: Sphinx directives and roles (an extension of the
language), Docutils configuration settings, and the standard definition files
html-roles.txtands5defs.txt, named on the directives page. - Viewer: the file opens as plain text; headings, directives and roles are not interpreted.
Links
Software
- Sphinx – documentation generator that builds websites and PDFs from reStructuredText (Python)
- Docutils – the reference tools that convert reStructuredText to HTML, LaTeX and more (Python)
- Pandoc – command-line converter that reads and writes reStructuredText (Windows, macOS, Linux)
- GitHub – code hosting site that shows .rst files as formatted pages (web browsers)
Reference
- reStructuredText – the Docutils project’s pages, with the full specification
- reStructuredText Markup Specification – the definition of the syntax
- reStructuredText Directives – the standard directives and their options
- reStructuredText Interpreted Text Roles – the standard roles