Create a parser:: parser = () Several optional arguments may be passed to modify the parser’s behavior. Please see. 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. RST is a file format formely created by Python community to write documentation (and so, is part of Docutils). RST files are simple text files with lightweight syntax.
|Published (Last):||8 December 2013|
|PDF File Size:||16.51 Mb|
|ePub File Size:||7.29 Mb|
|Price:||Free* [*Free Regsitration Required]|
The quoting characters are preserved in the processed document.
— Sphinx +/4f37b33 documentation
It will be called with the filename, line, col, and type of any error found during parsing. The syntax of directives is detailed in the reStructuredText Markup Specificationand standard directives are described in reStructuredText Directives.
Odcutils are examples of body elements: It is equivalent to a line block with different rendering: The role may be inferred implicitly as above; the “default role” is used or indicated explicitly, using a role marker. Converts the argument into an integer.
If a block quote should immediately follow a directive, use an empty comment in-between see Comments below. This text is parsed as an enumerated list item: This is a paragraph. Multiple block quotes may occur consecutively if terminated with attributions. It may be used within substitution definitions only. Internal hyperlink targets have empty docutiils blocks.
Any serious markup system requires an escaping mechanism to override the default docutilw of the characters used for the markup.
Here are examples of incorrectly docjtils bullet lists: Interpreted Text Doctree element: Transition markers require blank lines before and after:. The actual highlighting requires a style-sheet e. In the example above, a literal block is “embedded” within a sentence that begins in one physical paragraph and ends in another.
Tab stops are at every 8th column. Field Lists Doctree elements: They become topic elements with “Dedication” or “Abstract” titles or language equivalents immediately following the docinfo element. Although a reStructuredText parser will preserve runs of spaces docurils its output, the final representation of the processed document is dependent on the output formatter, thus the preservation of whitespace cannot be guaranteed. Substitution references may be used to associate inline text with an externally defined presentation style:.
These are “one-off” hyperlinks.
Paragraphs are separated by blank lines and are left-aligned. Two colons are used after the directive type for these reasons:.
In the text body, there is a source link, a reference name with a trailing underscore or two underscores for anonymous hyperlinks:. Similarly, a lone second-level section title immediately after the “document title” can become the document dicutils. None; affects subsequent parsing. Customizing the Parser Anything that isn’t already customizable is that way simply because that type of customizability hasn’t been implemented yet.
The inline markup end-string must be separated by at least one character from the start-string. Used when initiating a nested parse. This is good for API documentation because many symbols are repated in different modules. The registered bibliographic field names and their corresponding doctree elements are as follows:. If docutild single-line paragraph begins with text identical to an enumerator “A.
Strongly emphasized text is typically displayed in boldface.
Any unrecognized fields will remain as generic fields in the docinfo element. SmartQuotes ] def parse selfinputstringdocument: Dicutils example, this input:.
In addition, the auto-enumerator, ” “, may be used to automatically enumerate a list. Multiple levels of indentation within a block quote will result in more complex structures: