Template:Short description Template:Distinguish Template:Infobox file format reStructuredText (RST, ReST, or reST) is a file format for textual data used primarily in the Python programming language community for technical documentation.

It is part of the Docutils project of the Python Doc-SIG (Documentation Special Interest Group), aimed at creating a set of tools for Python similar to Javadoc for Java or Plain Old Documentation (POD) for Perl. Docutils can extract comments and information from Python programs, and format them into various forms of program documentation.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

In this sense, reStructuredText is a lightweight markup language designed to be both processable by documentation-processing software such as Docutils, and be easily readable by human programmers who are reading and writing Python source code.

HistoryEdit

reStructuredText evolved from an earlier lightweight markup language called StructuredText<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> (developed by Zope). There were a number of problems with StructuredText, and reST was developed to address them.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> The name reStructuredText was chosen to indicate that reST is a "revised, reworked, and reinterpreted StructuredText."<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

Parts of the reST syntax were inspired by the Setext language from the early 1990s. Elements of the common RFC822 Internet Message Format and Javadoc formats were also considered for inclusion in the design.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

reStructuredText was first released in June 2001.<ref name="rst-first-release">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> It began to see significant use in the Python community in 2002.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

Reference implementationEdit

The reference implementation of the reST parser is a component of the Docutils text processing framework in the Python programming language, but other parsers are available.

The Docutils project has not registered any MIME type for reStructuredText nor designated any unregistered MIME type as official, but documents the MIME type text/x-rst as in de facto use by, for example, the build system for the Python website.<ref name="docutilsmime">{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> The same MIME type is used in the freedesktop.org file type database used by desktop environments on Linux.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> Another MIME type, <syntaxhighlight lang="text" class="" style="" inline="1">text/prs.fallenstein.rst</syntaxhighlight>, was registered as a vanity MIME type by a third party in 2003 to represent reStructuredText, and remains the only IANA-registered MIME type for reStructuredText,<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> although it is not acknowledged as such by the Docutils project.<ref name="docutilsmime"/>

ApplicationsEdit

reStructuredText is commonly used for technical documentation, for example, in documentation of Python libraries.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> However, it is suitable for a wide range of texts.

Since 2008, reST has been a core component of Python's Sphinx document generation system.

Trac also supports reStructuredText,<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> as do GitHub and Bitbucket.

In 2011, Distributed Proofreaders, which prepared texts for Project Gutenberg, was considering adoption of reST as a basic format from which other ebook formats could be generated.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>Template:Update inline

In July 2016 the Linux kernel project decided to transition from DocBook based documentation to reStructuredText and the Sphinx toolchain.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref><ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>Template:Circular reference

The software build tool CMake switched from a custom markup language to reStructuredText in version 3.0 for its documentation.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

ExamplesEdit

Text using rST syntax Corresponding HTML produced by an rST processor Text viewed in a browser

<syntaxhighlight lang="rst">

====Edit

Document Heading

====Edit

Heading

=Edit

Sub-heading


Paragraphs are separated by a blank line. </syntaxhighlight>

<syntaxhighlight lang="html">

Document Heading

Heading

Sub-heading

Paragraphs are separated by a blank line.

</syntaxhighlight>

Document Heading
Heading
Sub-heading

Paragraphs are separated by a blank line.

<syntaxhighlight lang="rst">Text attributes *emphasis*, **strong emphasis**, ``monospace``.

Horizontal rule:


</syntaxhighlight>

<syntaxhighlight lang="html">

Text attributes emphasis, strong emphasis, monospace.

Horizontal rule:


</syntaxhighlight>

Text attributes emphasis, strong emphasis, monospace.

Horizontal rule:


<syntaxhighlight lang="rst">

Bullet list:

  • apples
  • oranges
  • pears

Numbered list:

1. lather 2. rinse 3. repeat

Nested lists:

1. fruits

  * apple
  * banana

2. vegetables

  * carrot
  * broccoli

</syntaxhighlight>

<syntaxhighlight lang="html">

Bullet list:

  • apples
  • oranges
  • pears

Numbered list:

  1. lather
  2. rinse
  3. repeat

Nested lists:

  1. fruits
    • apple
    • banana
  2. vegetables
    • carrot
    • broccoli

</syntaxhighlight>

Bullet list:
  • apples
  • oranges
  • pears

Numbered list:

  1. lather
  2. rinse
  3. repeat

Nested lists:

  1. fruits
    • apple
    • banana
  2. vegetables
    • carrot
    • broccoli
<syntaxhighlight lang="rst">An `example <http://example.com>`_.

.. image:: Icon-pictures.png

   :alt: Image

If text is indented, it is treated as a block quotation:

   Should array indices start at 0 or 1?
   My suggested compromise of 0.5 was rejected without, I thought, proper consideration.
   -- Stan Kelly-Bootle

reST uses :: at the end of the paragraph prior to a pre-formatted code block::

   Y = lambda f: (lambda x: f(x(x)))(lambda x: f(x(x)))
Multi-line text can span in tables with a pipe character.

</syntaxhighlight>

<syntaxhighlight lang="html">

An <a href="http://example.com">example</a>.

<img alt="Image"src="Icon-pictures.png" />

If text is indented, it is treated as a block quotation, and the final attribution line is handled automatically:

Should array indices start at 0 or 1? My suggested compromise of 0.5 was rejected without, I thought, proper consideration.

-- Stan Kelly-Bootle

reST uses :: at the end of the paragraph prior to a pre-formatted code block:

Y = lambda f: (lambda x: f(x(x)))(lambda x: f(x(x)))

Multi-line text can
span in tables
with a pipe character.

</syntaxhighlight>

An example.

icon

If text is indented, it is treated as a block quotation, and the final attribution line is handled automatically:

Should array indices start at 0 or 1? My suggested compromise of 0.5 was rejected without, I thought, proper consideration.

-- Stan Kelly-Bootle

reST uses :: at the end of the paragraph prior to a pre-formatted code block:

Y = lambda f: (lambda x: f(x(x)))(lambda x: f(x(x)))

Multi-line text can
span in tables
with a pipe character.

See alsoEdit

ReferencesEdit

Template:Reflist

External linksEdit

Template:Lowercase Template:Document markup languages