reStructuredText cheat sheet

Blog arthicle metadata

reStructuredText cheat sheet
############################

:date: 2014-05-03 18:00
:tags: cheatsheet, pelican
:category: blog
:slug: 2014-05-03-rst
:author: arnulf
:summary: My cheat sheet for `reStructuredText <http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html>`_ syntax with examples how it will look after parsing. reStructuredText_ is an alternative for `Markedown <http://daringfireball.net/projects/markdown>`_.

Sections

rST doc

===============
 Second heading
===============

---------------
 Third heading
---------------

Fourth heading
==============

Fift heading
-------------

Sixt heading
`````````````

Second heading

Third heading

Fourth heading

Fift heading
Sixt heading

Quick Syntax Overview

rST doc

Paragraphs contain text and may contain inline markup: *emphasis*, **strong emphasis**, `interpreted text`, ``inline literals``, standalone hyperlinks (http://www.python.org), external hyperlinks (Python_), internal cross-references (example_), footnote references ([1]_), citation references ([CIT2002]_), substitution references (|example|), _`inline internal targets` and :code:`code snippets`.

Paragraphs contain text and may contain inline markup: emphasis, strong emphasis, interpreted text, inline literals, standalone hyperlinks (http://www.python.org), external hyperlinks (Python), internal cross-references (example), footnote references ([1]), citation references ([CIT2002]), substitution references (Replaced text), inline internal targets and code snippets.

Lists

* One

* Two

 1. Test

 2. Test

* Three
  • One
  • Two
  1. Test
  2. Test
  • Three

Footnotes

..  [1] A footnote contains body elements, consistently
    indented by at least 3 spaces.
[1]A footnote contains body elements, consistently indented by at least 3 spaces.

Citations

..  [CIT2002] Just like a footnote, except the label is
    textual.
[CIT2002]Just like a footnote, except the label is textual.

Replacement text

..  |example| replace:: Replaced text

Inline internal targets

Point to `inline internal targets`_.

Point to inline internal targets.

Definitions of terms

term (up to a line of text)
   Definition of the term, which must be indented

   and can even consist of multiple paragraphs

next term
   Description.
term (up to a line of text)

Definition of the term, which must be indented

and can even consist of multiple paragraphs

next term
Description.

Field list

:what: Field lists map field names to field bodies, like
       database records.  They are often part of an extension
       syntax.

:how: The field marker is a colon, the field name, and a
      colon.

      The field body may contain one or more body elements,
      indented relative to the field marker.
what:

Field lists map field names to field bodies, like database records. They are often part of an extension syntax.

how:

The field marker is a colon, the field name, and a colon.

The field body may contain one or more body elements, indented relative to the field marker.

Visualize math

rST doc

.. math::

  α_t(i) = P(O_1, O_2, … O_t, q_t = S_i λ)
αt(i) = P(O1, O2, …Ot, qt = Siλ)

Tables

rST doc

Grid tables

+--------------+----------+-----------+---------------+
| row 1, col 1 | column 2 | column 3  | column 4      |
+==============+==========+===========+===============+
| row 2        |  Use the command :code:`ls | more`.  |
+--------------+----------+-----------+---------------+
| row 3        |          |           |               |
+--------------+----------+-----------+---------------+
row 1, col 1 column 2 column 3 column 4
row 2 Use the command ls | more.
row 3      

Simple tables

=====  =====  =======
A      B      A and B
=====  =====  =======
False  False  False
True   False  False
False  True   False
True   True   True
=====  =====  =======
A B A and B
False False False
True False False
False True False
True True True

Comments