reStructuredText (RST, ReST, or reST) is a file format for textual data used primarily in the
Python programming language
Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.
Python is dynamically type-checked and garbage-collected. It supports multiple prog ...
community for
technical documentation
Technical may refer to:
* Technical (vehicle), an improvised fighting vehicle
* Technical area, an area which a manager, other coaching personnel, and substitutes are allowed to occupy during a football match
* Technical advisor, a person who ...
.
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
Javadoc (also capitalized as JavaDoc or javadoc) is an API documentation generator for the Java programming language. Based on information in Java source code, Javadoc generates documentation formatted as HTML and other formats via extensions. ...
for
Java
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
or
Plain Old Documentation (POD) for
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Though Perl is not officially an acronym, there are various backronyms in use, including "Practical Extraction and Reporting Language".
Perl was developed ...
. Docutils can extract comments and information from Python programs, and format them into various forms of program documentation.
In this sense, reStructuredText is a
lightweight markup language
A lightweight markup language (LML), also termed a simple or humane markup language, is a markup language with simple, unobtrusive syntax. It is designed to be easy to write using any generic text editor and easy to read in its raw form. Lightw ...
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
In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer.
Since a computer, at base, only ...
.
History
reStructuredText evolved from an earlier lightweight markup language called StructuredText (developed by
Zope
Zope is a family of free and open-source software, free and open-source World Wide Web, web application servers written in Python (programming language), Python, and their associated online community. Zope stands for "Z Object Publishing Environm ...
). There were a number of problems with StructuredText, and reST was developed to address them.
The name reStructuredText was chosen to indicate that reST is a "revised, reworked, and reinterpreted StructuredText."
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
Javadoc (also capitalized as JavaDoc or javadoc) is an API documentation generator for the Java programming language. Based on information in Java source code, Javadoc generates documentation formatted as HTML and other formats via extensions. ...
formats were also considered for inclusion in the design.
reStructuredText was first released in June 2001.
It began to see significant use in the Python community in 2002.
Reference implementation
The reference implementation of the reST
parser
Parsing, syntax analysis, or syntactic analysis is a process of analyzing a string of symbols, either in natural language, computer languages or data structures, conforming to the rules of a formal grammar by breaking it into parts. The term '' ...
is a component of the Docutils text processing framework in the
Python programming language
Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.
Python is dynamically type-checked and garbage-collected. It supports multiple prog ...
, 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.
The same MIME type is used in the
freedesktop.org file type database used by
desktop environment
In computing, a desktop environment (DE) is an implementation of the desktop metaphor made of a bundle of programs running on top of a computer operating system that share a common graphical user interface (GUI), sometimes described as a graphi ...
s on
Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
. Another MIME type, , was registered as a
vanity MIME type by a third party in 2003 to represent reStructuredText, and remains the only
IANA
The Internet Assigned Numbers Authority (IANA) is a standards organization that oversees global IP address allocation, autonomous system number allocation, root zone management in the Domain Name System (DNS), media types, and other Internet P ...
-registered MIME type for reStructuredText, although it is not acknowledged as such by the Docutils project.
Applications
reStructuredText is commonly used for technical documentation, for example, in documentation of Python libraries. However, it is suitable for a wide range of texts.
Since 2008, reST has been a core component of Python's
Sphinx
A sphinx ( ; , ; or sphinges ) is a mythical creature with the head of a human, the body of a lion, and the wings of an eagle.
In Culture of Greece, Greek tradition, the sphinx is a treacherous and merciless being with the head of a woman, th ...
document generation system.
Trac
Trac is an open-source, web-based project management and bug tracking system. It has been adopted by a variety of organizations for use as a bug tracking system for both free and open-source software and proprietary projects and products. Tr ...
also supports reStructuredText, as do
GitHub
GitHub () is a Proprietary software, proprietary developer platform that allows developers to create, store, manage, and share their code. It uses Git to provide distributed version control and GitHub itself provides access control, bug trackin ...
and
Bitbucket
Bitbucket is a Git-based source code repository hosting service owned by Atlassian. Bitbucket offers both commercial plans and free accounts with an unlimited number of private repositories.
Services Bitbucket Cloud
Bitbucket Cloud (pre ...
.
In 2011,
Distributed Proofreaders, which prepared texts for
Project Gutenberg
Project Gutenberg (PG) is a volunteer effort to digitize and archive cultural works, as well as to "encourage the creation and distribution of eBooks."
It was founded in 1971 by American writer Michael S. Hart and is the oldest digital li ...
, was considering adoption of reST as a basic format from which other ebook formats could be generated.
In July 2016 the
Linux kernel
The Linux kernel is a Free and open-source software, free and open source Unix-like kernel (operating system), kernel that is used in many computer systems worldwide. The kernel was created by Linus Torvalds in 1991 and was soon adopted as the k ...
project decided to transition from
DocBook
DocBook is a Semantics (computer science), semantic markup language for technical documentation. It was originally intended for writing technical documents related to computer hardware and software, but it can be used for any other sort of docume ...
based documentation to reStructuredText and the
Sphinx
A sphinx ( ; , ; or sphinges ) is a mythical creature with the head of a human, the body of a lion, and the wings of an eagle.
In Culture of Greece, Greek tradition, the sphinx is a treacherous and merciless being with the head of a woman, th ...
toolchain.
The software build tool
CMake switched from a custom markup language to reStructuredText in version 3.0 for its documentation.
Examples
See also
*
Comparison of document markup languages
*
Comparison of documentation generators
The following tables compare general and technical information for a number of documentation generators. Please see the individual products' articles for further information. Unless otherwise specified in footnotes, comparisons are based on the s ...
*
Comparison of note-taking software
References
External links
Official reStructuredText website with reference pages
{{Document markup languages
Lightweight markup languages
Source code documentation formats