| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta charset="UTF-8"> |
| 5 | <style> |
| 6 | .r1 {font-weight: bold} |
| 7 | .r2 {color: #bd93f9; text-decoration-color: #bd93f9; background-color: #282a36; text-decoration: underline} |
| 8 | .r3 {color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #282a36} |
| 9 | .r4 {color: #f1fa8c; text-decoration-color: #f1fa8c; font-weight: bold} |
| 10 | .r5 {color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #282a36; font-style: italic} |
| 11 | .r6 {color: #ffffff; text-decoration-color: #ffffff} |
| 12 | .r7 {color: #bcbcbc; text-decoration-color: #bcbcbc} |
| 13 | body { |
| 14 | color: #f8f8f2; |
| 15 | background-color: #282a36; |
| 16 | } |
| 17 | </style> |
| 18 | </head> |
| 19 | <body> |
| 20 | <pre style="font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace"><code style="font-family:inherit"><span class="r1">╔══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗</span> |
| 21 | <span class="r1">║ An Introduction to reStructuredText ║</span> |
| 22 | <span class="r1">╚══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝</span> |
| 23 | ┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ |
| 24 | ┃<span class="r1"> Field Name </span>┃<span class="r1"> Field Value </span>┃ |
| 25 | ┡━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ |
| 26 | │ <span class="r1">Author </span> │ David Goodger │ |
| 27 | ├────────────┼────────────────────────────────────────────────────────┤ |
| 28 | │ <span class="r1">Contact </span> │ [email protected] │ |
| 29 | ├────────────┼────────────────────────────────────────────────────────┤ |
| 30 | │ <span class="r1">Revision </span> │ $Revision: 8959 $ │ |
| 31 | ├────────────┼────────────────────────────────────────────────────────┤ |
| 32 | │ <span class="r1">Date </span> │ $Date: 2022-01-21 14:45:42 +0100 (Fr, 21. Jän 2022) $ │ |
| 33 | ├────────────┼────────────────────────────────────────────────────────┤ |
| 34 | │ <span class="r1">Copyright </span> │ This document has been placed in the public domain. │ |
| 35 | └────────────┴────────────────────────────────────────────────────────┘ |
| 36 | <span class="r2">reStructuredText</span><span class="r3"> is an easy-to-read, what-you-see-is-what-you-get plaintext markup syntax and parser system. It is </span> |
| 37 | <span class="r3">useful for inline program documentation (such as Python docstrings), for quickly creating simple web pages, and for </span> |
| 38 | <span class="r3">standalone documents. </span><a class="r2" href="https://docutils.sourceforge.io/rst.html">reStructuredText</a><span class="r3"> is a proposed revision and reinterpretation of the </span><a class="r2" href="https://zopestructuredtext.readthedocs.org/">StructuredText</a><span class="r3"> and </span><a class="r2" href="https://docutils.sourceforge.io/mirror/setext.html">Setext</a><span class="r3"> </span> |
| 39 | <span class="r3">lightweight markup systems.</span> |
| 40 | |
| 41 | <span class="r3">reStructuredText is designed for extensibility for specific application domains. Its parser is a component of </span><a class="r2" href="https://docutils.sourceforge.io/">Docutils</a><span class="r3">.</span> |
| 42 | |
| 43 | <span class="r3">This document defines the </span><span class="r2">goals</span><span class="r3"> of reStructuredText and provides a </span><span class="r2">history</span><span class="r3"> of the project. It is written using the </span> |
| 44 | <span class="r3">reStructuredText markup, and therefore serves as an example of its use. For a gentle introduction to using </span> |
| 45 | <span class="r3">reStructuredText, please read </span><a class="r2" href="../../user/rst/quickstart.html">A ReStructuredText Primer</a><span class="r3">. The </span><a class="r2" href="../../user/rst/quickref.html">Quick reStructuredText</a><span class="r3"> user reference is also useful. The</span> |
| 46 | <a class="r2" href="restructuredtext.html">reStructuredText Markup Specification</a><span class="r3"> is the definitive reference. There is also an analysis of the </span><a class="r2" href="../../dev/rst/problems.html">Problems With </a> |
| 47 | <a class="r2" href="../../dev/rst/problems.html">StructuredText</a><span class="r3">.</span> |
| 48 | |
| 49 | <span class="r3">ReStructuredText's web page is </span><a class="r2" href="https://docutils.sourceforge.io/rst.html">https://docutils.sourceforge.io/rst.html</a><span class="r3">.</span> |
| 50 | |
| 51 | <span class="r1">╔══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗</span> |
| 52 | <span class="r1">║ Goals ║</span> |
| 53 | <span class="r1">╚══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝</span> |
| 54 | <span class="r3">The primary goal of </span><span class="r2">reStructuredText</span><span class="r3"> is to define a markup syntax for use in Python docstrings and other documentation </span> |
| 55 | <span class="r3">domains, that is readable and simple, yet powerful enough for non-trivial use. The intended purpose of the </span> |
| 56 | <span class="r3">reStructuredText markup is twofold:</span> |
| 57 | |
| 58 | <span class="r4"> • </span>the establishment of a set of standard conventions allowing the expression of structure within plaintext, and |
| 59 | <span class="r4"> • </span>the conversion of such documents into useful structured data formats. |
| 60 | |
| 61 | <span class="r3">The secondary goal of reStructuredText is to be accepted by the Python community (by way of being blessed by PythonLabs </span> |
| 62 | <span class="r3">and the BDFL ) as a standard for Python inline documentation (possibly one of several standards, to account for taste).</span> |
| 63 | |
| 64 | <span class="r3">To clarify the primary goal, here are specific design goals, in order, beginning with the most important:</span> |
| 65 | |
| 66 | <span class="r4"> 1</span> Readable. The marked-up text must be easy to read without any prior knowledge of the markup language. It should be |
| 67 | easily read in raw form as in processed form. |
| 68 | <span class="r4"> 2</span> Unobtrusive. The markup that is used should be as simple and unobtrusive as possible. The simplicity of markup |
| 69 | constructs should be roughly proportional to their frequency of use. The most common constructs, with natural and |
| 70 | obvious markup, should be the simplest and most unobtrusive. Less common constructs, for which there is no natural or |
| 71 | obvious markup, should be distinctive. |
| 72 | <span class="r4"> 3</span> Unambiguous. The rules for markup must not be open for interpretation. For any given input, there should be one and |
| 73 | only one possible output (including error output). |
| 74 | <span class="r4"> 4</span> Unsurprising. Markup constructs should not cause unexpected output upon processing. As a fallback, there must be a |
| 75 | to prevent unwanted markup processing when a markup construct is used in a non-markup context (for example, when |
| 76 | documenting the markup syntax itself). |
| 77 | <span class="r4"> 5</span> Intuitive. Markup should be as obvious and easily remembered as possible, for the author as well as for the reader. |
| 78 | Constructs should take their cues from such naturally occurring sources as plaintext email messages, newsgroup postings, |
| 79 | and text documentation such as README.txt files. |
| 80 | <span class="r4"> 6</span> Easy. It should be easy to mark up text using any ordinary text editor. |
| 81 | <span class="r4"> 7</span> Scalable. The markup should be applicable regardless of the length of the text. |
| 82 | <span class="r4"> 8</span> Powerful. The markup should provide enough constructs to produce a reasonably rich structured document. |
| 83 | <span class="r4"> 9</span> Language-neutral. The markup should apply to multiple natural (as well as artificial) languages, not only English. |
| 84 | <span class="r4"> 10</span> Extensible. The markup should provide a simple syntax and interface for adding more complex general markup, and cus |
| 85 | markup. |
| 86 | <span class="r4"> 11</span> Output-format-neutral. The markup will be appropriate for processing to multiple output formats, and will not be bi |
| 87 | toward any particular format. |
| 88 | |
| 89 | <span class="r3">The design goals above were used as criteria for accepting or rejecting syntax, or selecting between alternatives.</span> |
| 90 | |
| 91 | <span class="r3">It is emphatically </span><span class="r5">not</span><span class="r3"> the goal of reStructuredText to define docstring semantics, such as docstring contents or </span> |
| 92 | <span class="r3">docstring length. These issues are orthogonal to the markup syntax and beyond the scope of this specification.</span> |
| 93 | |
| 94 | <span class="r3">Also, it is not the goal of reStructuredText to maintain compatibility with </span><span class="r2">StructuredText</span><span class="r3"> or </span><span class="r2">Setext</span><span class="r3">. reStructuredText </span> |
| 95 | <span class="r3">shamelessly steals their great ideas and ignores the not-so-great.</span> |
| 96 | |
| 97 | <span class="r3">Author's note:</span> |
| 98 | |
| 99 | <span class="r6">Due to the nature of the problem we're trying to solve (or, perhaps, due to the nature of the proposed solution), </span> |
| 100 | <span class="r6">the above goals unavoidably conflict. I have tried to extract and distill the wisdom accumulated over the years in the </span> |
| 101 | <span class="r6">Python Doc-SIG mailing list and elsewhere, to come up with a coherent and consistent set of syntax rules, and the above </span> |
| 102 | <span class="r6">goals by which to measure them.</span> |
| 103 | |
| 104 | |
| 105 | <span class="r1">╔══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗</span> |
| 106 | <span class="r1">║ History ║</span> |
| 107 | <span class="r1">╚══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝</span> |
| 108 | <span class="r2">reStructuredText</span><span class="r3">, the specification, is based on </span><span class="r2">StructuredText</span><span class="r3"> and </span><span class="r2">Setext</span><span class="r3">. StructuredText was developed by Jim Fulton </span> |
| 109 | <span class="r3">of </span><span class="r2">Zope Corporation</span><span class="r3"> (formerly Digital Creations) and first released in 1996. It is now released as a part of the </span> |
| 110 | <span class="r3">open-source "Z Object Publishing Environment" (</span><a class="r2" href="https://www.zope.dev">ZOPE</a><span class="r3">). Ian Feldman's and Tony Sanders' earlier </span><span class="r2">Setext</span><span class="r3"> specification was </span> |
| 111 | <span class="r3">either an influence on StructuredText or, by their similarities, at least evidence of the correctness of this approach.</span> |
| 112 | |
| 113 | <span class="r3">I discovered </span><span class="r2">StructuredText</span><span class="r3"> in late 1999 while searching for a way to document the Python modules in one of my projects.</span> |
| 114 | <span class="r3">Version 1.1 of StructuredText was included in Daniel Larsson's </span><a class="r2" href="http://starship.python.net/crew/danilo/pythondoc/">pythondoc</a><span class="r3">. Although I was not able to get pythondoc to </span> |
| 115 | <span class="r3">work for me, I found StructuredText to be almost ideal for my needs. I joined the Python </span><span class="r2">Doc-SIG</span><span class="r3"> (Documentation Special</span> |
| 116 | <span class="r3">Interest Group) mailing list and found an ongoing discussion of the shortcomings of the StructuredText "standard". This</span> |
| 117 | <span class="r3">discussion has been going on since the inception of the mailing list in 1996, and possibly predates it.</span> |
| 118 | |
| 119 | <span class="r3">I decided to modify the original module with my own extensions and some suggested by the Doc-SIG members. I soon </span> |
| 120 | <span class="r3">realized that the module was not written with extension in mind, so I embarked upon a general reworking, including </span> |
| 121 | <span class="r3">adapting it to the "re" regular expression module (the original inspiration for the name of this project). Soon after I</span> |
| 122 | <span class="r3">completed the modifications, I discovered that StructuredText.py was up to version 1.23 in the ZOPE distribution. </span> |
| 123 | <span class="r3">Implementing the new syntax extensions from version 1.23 proved to be an exercise in frustration, as the complexity of </span> |
| 124 | <span class="r3">the module had become overwhelming.</span> |
| 125 | |
| 126 | <span class="r3">In 2000, development on StructuredTextNG ("Next Generation") began at </span><a class="r2" href="http://www.zope.com">Zope Corporation</a><span class="r3"> (then Digital Creations). It </span> |
| 127 | <span class="r3">seems to have many improvements, but still suffers from many of the problems of classic StructuredText.</span> |
| 128 | |
| 129 | <span class="r3">I decided that a complete rewrite was in order, and even started a </span><a class="r2" href="http://structuredtext.sourceforge.net/">reStructuredText SourceForge project</a><span class="r3"> (now inactive). </span> |
| 130 | <span class="r3">My motivations (the "itches" I aim to "scratch") are as follows:</span> |
| 131 | |
| 132 | <span class="r4"> • </span>I need a standard format for inline documentation of the programs I write. This inline documentation has to be |
| 133 | convertible to other useful formats, such as HTML. I believe many others have the same need. |
| 134 | <span class="r4"> • </span>I believe in the Setext/StructuredText idea and want to help formalize the standard. However, I feel the current |
| 135 | specifications and implementations have flaws that desperately need fixing. |
| 136 | <span class="r4"> • </span>reStructuredText could form part of the foundation for a documentation extraction and processing system, greatly |
| 137 | benefitting Python. But it is only a part, not the whole. reStructuredText is a markup language specification and a |
| 138 | reference parser implementation, but it does not aspire to be the entire system. I don't want reStructuredText or a |
| 139 | hypothetical Python documentation processor to die stillborn because of over-ambition. |
| 140 | <span class="r4"> • </span>Most of all, I want to help ease the documentation chore, the bane of many a programmer. |
| 141 | |
| 142 | <span class="r3">Unfortunately I was sidetracked and stopped working on this project. In November 2000 I made the time to enumerate the </span> |
| 143 | <span class="r3">problems of StructuredText and possible solutions, and complete the first draft of a specification. This first draft </span> |
| 144 | <span class="r3">was posted to the Doc-SIG in three parts:</span> |
| 145 | |
| 146 | <span class="r4"> • </span>A Plan for Structured Text |
| 147 | <span class="r4"> • </span>Problems With StructuredText |
| 148 | <span class="r4"> • </span>reStructuredText: Revised Structured Text Specification |
| 149 | |
| 150 | <span class="r3">In March 2001 a flurry of activity on the Doc-SIG spurred me to further revise and refine my specification, the result </span> |
| 151 | <span class="r3">of which you are now reading. An offshoot of the reStructuredText project has been the realization that a single markup</span> |
| 152 | <span class="r3">scheme, no matter how well thought out, may not be enough. In order to tame the endless debates on Doc-SIG, a flexible </span> |
| 153 | <a class="r2" href="../../peps/pep-0256.html">Docstring Processing System framework</a><span class="r3"> needed to be constructed. This framework has become the more important of the two</span> |
| 154 | <span class="r3">projects; </span><span class="r2">reStructuredText</span><span class="r3"> has found its place as one possible choice for a single component of the larger framework.</span> |
| 155 | |
| 156 | <span class="r3">The project web site and the first project release were rolled out in June 2001, including posting the second draft of </span> |
| 157 | <span class="r3">the spec and the first draft of PEPs 256, 257, and 258 to the Doc-SIG. These documents and the project implementation</span> |
| 158 | <span class="r3">proceeded to evolve at a rapid pace. Implementation history details can be found in the </span><a class="r2" href="../../../HISTORY.html">project history file</a><span class="r3">.</span> |
| 159 | |
| 160 | <span class="r3">In November 2001, the reStructuredText parser was nearing completion. Development of the parser continued with the </span> |
| 161 | <span class="r3">addition of small convenience features, improvements to the syntax, the filling in of gaps, and bug fixes. After a long</span> |
| 162 | <span class="r3">holiday break, in early 2002 most development moved over to the other Docutils components, the "Readers", "Writers", and</span> |
| 163 | <span class="r3">"Transforms". A "standalone" reader (processes standalone text file documents) was completed in February, and a basic </span> |
| 164 | <span class="r3">HTML writer (producing HTML 4.01, using CSS-1) was completed in early March.</span> |
| 165 | |
| 166 | <a class="r2" href="../../peps/pep-0287.html">PEP 287</a><span class="r3">, "reStructuredText Standard Docstring Format", was created to formally propose reStructuredText as a standard </span> |
| 167 | <span class="r3">format for Python docstrings, PEPs, and other files. It was first posted to </span><a class="r2" href="news:comp.lang.python">comp.lang.python</a><span class="r3"> and the </span><a class="r2" href="https://mail.python.org/pipermail/python-dev/">Python-dev</a><span class="r3"> mailing</span> |
| 168 | <span class="r3">list on 2002-04-02.</span> |
| 169 | |
| 170 | <span class="r3">Version 0.4 of the </span><span class="r2">reStructuredText</span><span class="r3"> and </span><a class="r2" href="http://docstring.sourceforge.net/">Docstring Processing System</a><span class="r3"> projects were released in April 2002. The two </span> |
| 171 | <span class="r3">projects were immediately merged, renamed to "</span><span class="r2">Docutils</span><span class="r3">", and a 0.1 release soon followed.</span> |
| 172 | <span class="r7">┌─────────────────────────────────────────────────────── Footer ───────────────────────────────────────────────────────┐</span> |
| 173 | <span class="r7">│</span> First drafts of the PEPs: <span class="r7">│</span> |
| 174 | <span class="r7">│</span> <span class="r7">│</span> |
| 175 | <span class="r7">│</span> PEP 256: Docstring Processing System Framework <span class="r7">│</span> |
| 176 | <span class="r7">│</span> <span class="r7">│</span> |
| 177 | <span class="r7">│</span> PEP 258: DPS Generic Implementation Details <span class="r7">│</span> |
| 178 | <span class="r7">│</span> <span class="r7">│</span> |
| 179 | <span class="r7">│</span> PEP 257: Docstring Conventions <span class="r7">│</span> |
| 180 | <span class="r7">│</span> <span class="r7">│</span> |
| 181 | <span class="r7">│</span> Current working versions of the PEPs can be found in <span class="r7">│</span> |
| 182 | <span class="r7">│</span> https://docutils.sourceforge.io/docs/peps/, and official versions <span class="r7">│</span> |
| 183 | <span class="r7">│</span> can be found in the master PEP repository. <span class="r7">│</span> |
| 184 | <span class="r7">│</span> <span class="r7">│</span> |
| 185 | <span class="r7">│</span> <span class="r7">│</span> |
| 186 | <span class="r7">│</span> <span class="r7">│</span> |
| 187 | <span class="r7">│</span> <span class="r7">│</span> |
| 188 | <span class="r7">│</span> <span class="r7">│</span> |
| 189 | <span class="r7">│</span> <span class="r7">│</span> |
| 190 | <span class="r7">└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘</span> |
| 191 | </code></pre> |
| 192 | </body> |
| 193 | </html> |