Jump to content

reStructuredText

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by ThefirstM (talk | contribs) at 21:51, 26 April 2014. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

reStructuredText
Filename extension
.rst
Internet media typetext/x-rst
Developed byDavid Goodger
Initial releaseApril 2, 2002; 22 years ago (2002-04-02)
Latest release
Revision 7629
March 11, 2013; 11 years ago (2013-03-11)
Free format?Public domain
Websitedocutils.sourceforge.net/docs/ref/rst/restructuredtext.html

reStructuredText is a file format for textual data used primarily in the Python community for technical documentation.

The reStructuredText (frequently abbreviated as reST) project is part of the Python programming language Docutils project of the Python Doc-SIG (Documentation Special Interest Group). The goal of the project is to create a set of tools for Python similar to Javadoc for Java or POD for Perl. Docutils can extract comments and information from Python programs, and format them into various forms of useful program documentation.[1]

The term reStructuredText is most frequently used to refer to the reST markup format developed by the reST project. In this sense, reST is a lightweight markup language designed to be both (a) processable by documentation-processing software such as Docutils, and (b) easily readable by human programmers who are reading and writing Python source code.

reStructuredText is sometimes abbreviated as RST, ReST, or reST. This can create confusion with Representational State Transfer (REST), an unrelated technology.

History

Setext (developed by Ian Feldman or Tony Sanders) and StructuredText (developed by Zope) were ancestor forms of lightweight markup language.

There were a number of problems with StructuredText. reST was a re-implementation and extension of the ideas in StructuredText, developed in order to address those problems.[2] The name reStructuredText was chosen to indicate that reST is a "revised, reworked, and reinterpreted StructuredText."[3]

reST began to see significant use in the Python community in 2002. Since 2008, reST has been a core component of Python's Sphinx document generation system.

Reference implementation

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.

Applications

reStructuredText is commonly used for technical documentation, for example, in documentation of Python libraries.[4] However, reStructuredText is suitable for a wide range of texts.

reST is a core component of Python's Sphinx document generation system.

Trac supports reStructuredText

Distributed Proofreaders, which prepares texts for Project Gutenberg, is considering adoption of reStructuredText as a basic format from which other ebook formats could be generated.[5]

Examples of reST markup

Headers:

Section Header
==============
Subsection Header
-----------------

Lists:

- A bullet list item

- Second item

  - A sub item

- Third item
1) An enumerated list item

2) Second item

   a) Sub item that goes on at length and thus needs
      to be wrapped. Note the indentation that must
      match the beginning of the text, not the 
      enumerator.

      i) Sub-sub item

3) Third item
#) Another enumerated list item

#) Second item  

Images:

.. image:: /path/to/image.jpg

Named links:

A sentence with links to Wikipedia_ and the `Linux kernel archive`_.

.. _Wikipedia: http://www.wikipedia.org/
.. _Linux kernel archive: http://www.kernel.org/

Anonymous links:

Another sentence with an `anonymous link to the Python website`__.

__ http://www.python.org/

N.B.: named links and anonymous links are enclosed in grave accents (`), and not in apostrophes (').

Literal blocks:

::

  some literal text
This may also be used inline at the end of a paragraph, like so::

  some more literal text
.. code:: python

   print("A literal block directive explicitly marked as python code")

See also

References

  1. ^ Mertz, David (2003-02-01). "XML Matters: reStructuredText". IBM developerWorks. Retrieved 2011-12-28.
  2. ^ Goodger, David (2006-09-22). "reStructuredText: Markup Syntax and Parser Component of Docutils". Docutils Project. Retrieved 2008-06-11.
  3. ^ Goodger, David (2008-01-05). "Docutils FAQ (Frequently Asked Questions)". Docutils Project. Retrieved 2008-06-25.
  4. ^ Goodger, David. "reStructuredText Docstring Format". PFS. Retrieved 18 Jan 2009.
  5. ^ Newby, Greg (2011-01-08). "Minutes of 2010 December 11 meeting". Distributed Proofreaders. Retrieved 2011-01-08.