from http://sphinx.pocoo.org/_sources/rest.txt

reStructuredText Primer

This section is a brief introduction to reStructuredText (reST) concepts and syntax, intended to provide authors with enough information to author documents productively. Since reST was designed to be a simple, unobtrusive markup language, this will not take too long.

Paragraphs

The paragraph (:duref:`ref <paragraphs>`) is the most basic block in a reST document. Paragraphs are simply chunks of text separated by one or more blank lines. As in Python, indentation is significant in reST, so all lines of the same paragraph must be left-aligned to the same level of indentation.

System Message: ERROR/3 (<string>, line 18); backlink

Unknown interpreted text role "duref".

Inline markup

The standard reST inline markup is quite simple: use

  • one asterisk: *text* for emphasis (italics),
  • two asterisks: **text** for strong emphasis (boldface), and
  • backquotes: ``text`` for code samples.

If asterisks or backquotes appear in running text and could be confused with inline markup delimiters, they have to be escaped with a backslash.

Be aware of some restrictions of this markup:

  • it may not be nested,
  • content may not start or end with whitespace: * text* is wrong,
  • it must be separated from surrounding text by non-word characters. Use a backslash escaped space to work around that: thisis\ *one*\ word.

These restrictions may be lifted in future versions of the docutils.

reST also allows for custom "interpreted text roles"', which signify that the enclosed text should be interpreted in a specific way. Sphinx uses this to provide semantic markup and cross-referencing of identifiers, as described in the appropriate section. The general syntax is :rolename:`content`.

Standard reST provides the following roles:

  • emphasis -- alternate spelling for *emphasis*
  • strong -- alternate spelling for **strong**
  • literal -- alternate spelling for ``literal``
  • subscript -- subscript text
  • superscript -- superscript text
  • title-reference -- for titles of books, periodicals, and other materials
class Test:

   def TestFunction(self):
       pass

MoinMoin: ReimarBauer/reST (last edited 2011-09-19 15:13:41 by ReimarBauer)