Debian Codegraph @

docs/ref/rst/introduction.rst

raw
1 .. include:: ../../header2.rst
2
3 =====================================
4 An Introduction to reStructuredText
5 =====================================
6 :Author: David Goodger
7 :Contact: [email protected]
8 :Revision: $Revision: 9906 $
9 :Date: $Date: 2024-08-15 10:43:38 +0200 (Do, 15. Aug 2024) $
10 :Copyright: This document has been placed in the public domain.
11
12 reStructuredText_ is an easy-to-read, what-you-see-is-what-you-get
13 plaintext markup syntax and parser system. It is useful for inline
14 program documentation (such as Python docstrings), for quickly
15 creating simple web pages, and for standalone documents.
16 reStructuredText_ is a proposed revision and reinterpretation of the
17 StructuredText_ and Setext_ lightweight markup systems.
18
19 reStructuredText is designed for extensibility for specific
20 application domains. Its parser is a component of Docutils_.
21
22 This document defines the goals_ of reStructuredText and provides a
23 history_ of the project. It is written using the reStructuredText
24 markup, and therefore serves as an example of its use. For a gentle
25 introduction to using reStructuredText, please read `A
26 ReStructuredText Primer`_. The `Quick reStructuredText`_ user
27 reference is also useful. The `reStructuredText Markup
28 Specification`_ is the definitive reference. There is also an
29 analysis of the `Problems With StructuredText`_.
30
31 ReStructuredText's web page is
32 https://docutils.sourceforge.io/rst.html.
33
34 .. _reStructuredText: https://docutils.sourceforge.io/rst.html
35 .. _StructuredText: https://zopestructuredtext.readthedocs.org/
36 .. _Setext: https://docutils.sourceforge.io/mirror/setext.html
37 .. _Docutils: https://docutils.sourceforge.io/
38 .. _A ReStructuredText Primer: ../../user/rst/quickstart.html
39 .. _Quick reStructuredText: ../../user/rst/quickref.html
40 .. _reStructuredText Markup Specification: restructuredtext.html
41 .. _Problems with StructuredText: ../../dev/rst/problems.html
42 .. _history: ./history.html
43
44
45 Goals
46 =====
47
48 The primary goal of reStructuredText_ is to define a markup syntax for
49 use in Python docstrings and other documentation domains, that is
50 readable and simple, yet powerful enough for non-trivial use. The
51 intended purpose of the reStructuredText markup is twofold:
52
53 - the establishment of a set of standard conventions allowing the
54 expression of structure within plaintext, and
55
56 - the conversion of such documents into useful structured data
57 formats.
58
59 To clarify the primary goal, here are specific design goals, in order,
60 beginning with the most important:
61
62 1. Readable. The marked-up text must be easy to read without any
63 prior knowledge of the markup language. It should be as easily
64 read in raw form as in processed form.
65
66 2. Unobtrusive. The markup that is used should be as simple and
67 unobtrusive as possible. The simplicity of markup constructs
68 should be roughly proportional to their frequency of use. The most
69 common constructs, with natural and obvious markup, should be the
70 simplest and most unobtrusive. Less common constructs, for which
71 there is no natural or obvious markup, should be distinctive.
72
73 3. Unambiguous. The rules for markup must not be open for
74 interpretation. For any given input, there should be one and only
75 one possible output (including error output).
76
77 4. Unsurprising. Markup constructs should not cause unexpected output
78 upon processing. As a fallback, there must be a way to prevent
79 unwanted markup processing when a markup construct is used in a
80 non-markup context (for example, when documenting the markup syntax
81 itself).
82
83 5. Intuitive. Markup should be as obvious and easily remembered as
84 possible, for the author as well as for the reader. Constructs
85 should take their cues from such naturally occurring sources as
86 plaintext email messages, newsgroup postings, and text
87 documentation such as README.rst files.
88
89 6. Easy. It should be easy to mark up text using any ordinary text
90 editor.
91
92 7. Scalable. The markup should be applicable regardless of the length
93 of the text.
94
95 8. Powerful. The markup should provide enough constructs to produce a
96 reasonably rich structured document.
97
98 9. Language-neutral. The markup should apply to multiple natural (as
99 well as artificial) languages, not only English.
100
101 10. Extensible. The markup should provide a simple syntax and
102 interface for adding more complex general markup, and custom
103 markup.
104
105 11. Output-format-neutral. The markup will be appropriate for
106 processing to multiple output formats, and will not be biased
107 toward any particular format.
108
109 The design goals above were used as criteria for accepting or
110 rejecting syntax, or selecting between alternatives.
111
112 It is emphatically *not* the goal of reStructuredText to define
113 docstring semantics, such as docstring contents or docstring length.
114 These issues are orthogonal to the markup syntax and beyond the scope
115 of this specification.
116
117 Also, it is not the goal of reStructuredText to maintain compatibility
118 with StructuredText_ or Setext_. reStructuredText shamelessly steals
119 their great ideas and ignores the not-so-great.
120
121 Author's note:
122
123 Due to the nature of the problem we're trying to solve (or,
124 perhaps, due to the nature of the proposed solution), the above
125 goals unavoidably conflict. I have tried to extract and distill
126 the wisdom accumulated over the years in the Python Doc-SIG_
127 mailing list and elsewhere, to come up with a coherent and
128 consistent set of syntax rules, and the above goals by which to
129 measure them.
130
131 There will inevitably be people who disagree with my particular
132 choices. Some desire finer control over their markup, others
133 prefer less. Some are concerned with very short docstrings,
134 others with full-length documents. This specification is an
135 effort to provide a reasonably rich set of markup constructs in a
136 reasonably simple form, that should satisfy a reasonably large
137 group of reasonable people.
138
139 David Goodger ([email protected]), 2001-04-20
140
141 .. _Doc-SIG: https://www.python.org/sigs/doc-sig/
142
143
144 .. Emacs settings
145
146 Local Variables:
147 mode: indented-text
148 mode: rst
149 indent-tabs-mode: nil
150 sentence-end-double-space: t
151 fill-column: 70
152 End: