Inline Markup¶
emphasis, strong emphasis, interpreted text, inline literal
.
*emphasis*, **strong emphasis**, `interpreted text`, ``inline literal``.
References and Links¶
ref, Targets, link, Inline Markup
reference_, :ref:`reference`, `link <http://example.com/>`_, :doc:`rst-cheatsheet`
Targets¶
.. _reference: http://example.com
Lists¶
item list
no extra space before dash
add blank line above
echo 2+2;
keep alignment and can use more lines
- item
- list
- add blank line above
.. code-block:: php
echo 2+2;
- keep alignment
and you can use more lines
Numeric Lists¶
Numeric List
is auto-numbered
- use line above and below
- or single space in alignment
- various numbering options
- sometimes ‘#’ fails
- so use numbers
here ‘#’ works though.
1. Numeric List
#. is auto-numbered
#. use line above
a. or single space in alignment
#. various numbering options
#. sometimes '#' fails
#. so use numbers
#. here '#' works though.
Definition Lists¶
- definition list
here is example:
echo 2+2;
- inline code
can be also used.
{"A":123}
definition list
here is example::
echo 2+2;
inline code
can be also used.
.. code-block:: json
{"A":123}
Option Lists¶
-a | option list start with ‘-‘ and a line |
--arguments | will have a special treatment |
/dos | for application arguments |
-a option list start with '-' and a line
--arguments will have a special treatment
/dos for application arguments
Section Structure¶
Title
=====
Titles are underlined (or over- and underlined) with
a nonalphanumeric character at least as long as the
text.
A lone top-level section is lifted up to be the
document's title
|
Title Titles are underlined (or over- and underlined) with a nonalphanumeric character at least as long as the text. A lone top-level section is lifted up to be the document’s title |
Blocks¶
This is a paragraph.
Paragraphs line up at their left edges, and are
normally separated by blank lines.
|
This is a paragraph. Paragraphs line up at their left edges, and are normally separated by blank lines. |
A paragraph containing only two colons indicates
the following indented or quoted text is a literal
block or quoted text is a literal block.
::
Whitespace, newlines, blank lines, and all kinds of
markup (like *this* or \this) is preserved here.
You can also tack the ``::`` at the end of a
paragraph::
It's very convenient to use this form.
Per-line quoting can also be used for unindented
blocks::
> Useful for quotes from email and
> for Haskell literate programming.
|
A paragraph containing only two colons indicates that the following indented or quoted text is a literal block. Whitespace, newlines, blank lines, and
all kinds of markup (like *this* or
\this) is preserved by literal blocks.
You can also tack the It's very convenient to use this form.
Per-line quoting can also be used for unindented blocks: > Useful for quotes from email and
> for Haskell literate programming.
|
| Line blocks are useful for addresses,
| verse, and adornment-free lists.
|
| Each new line begins with a
| vertical bar ("|").
| Line breaks and initial indents
| are preserved.
| Continuation lines are wrapped
portions of long lines; they begin
with spaces in place of vertical bars.
|
Line blocks are useful for addresses,
verse, and adornment-free lists.
Each new line begins with a
vertical bar (“|”).
Line breaks and initial indents
are preserved.
Continuation lines are wrapped
portions of long lines; they begin
with spaces in place of vertical bars.
|
Block quotes are just:
Indented paragraphs,
and they may nest.
|
Block quotes are just:
|
Doctest blocks are interactive
Python sessions. They begin with
"``>>>``" and end with a blank line.
>>> print "This is a doctest block."
This is a doctest block.
|
Doctest blocks are interactive
Python sessions. They begin with
“ >>> print "This is a doctest block."
This is a doctest block.
|
Tables¶
There are two syntaxes for tables in reStructuredText. Grid tables are complete but cumbersome to create. Simple tables are easy to create but limited (no row spans, etc.).
Header 1 | Header 2 | Header 3 |
---|---|---|
body row 1 | column 2 | column 3 |
body row 2 | Cells may span columns. | |
body row 3 | Cells may span rows. |
|
body row 4 |
Inputs | Output | |
---|---|---|
A | B | A or B |
False | False | False |
True | False | True |
False | True | True |
True | True | True |
————————————————————+——————————————————+
Explicit Markup¶
Explicit markup blocks are used for constructs which float (footnotes), have no direct paper-document representation (hyperlink targets, comments), or require specialized processing (directives). They all begin with two periods and whitespace, the “explicit markup start”.
Footnote references, like [5]_.
Note that footnotes may get
rearranged, e.g., to the bottom of
the "page".
.. [5] A numerical footnote. Note
there's no colon after the ``]``.
|
Footnote references, like [5]. Note that footnotes may get rearranged, e.g., to the bottom of the “page”.
|
||||||||
Autonumbered footnotes are
possible, like using [#]_ and [#]_.
.. [#] This is the first one.
.. [#] This is the second one.
They may be assigned 'autonumber
labels' - for instance,
[#fourth]_ and [#third]_.
.. [#third] a.k.a. third_
.. [#fourth] a.k.a. fourth_
|
Autonumbered footnotes are possible, like using [1] and [2].
They may be assigned ‘autonumber labels’ - for instance, [4] and [3].
|
||||||||
Auto-symbol footnotes are also
possible, like this: [*]_ and [*]_.
.. [*] This is the first one.
.. [*] This is the second one.
|
Auto-symbol footnotes are also possible, like this: [*] and [†].
|
||||||||
Citation references, like [CIT2002]_.
Note that citations may get
rearranged, e.g., to the bottom of
the "page".
.. [CIT2002] A citation
(as often used in journals).
Citation labels contain alphanumerics,
underlines, hyphens and fullstops.
Case is not significant.
Given a citation like [this]_, one
can also refer to it like this_.
.. [this] here.
|
Citation references, like [CIT2002]. Note that citations may get rearranged, e.g., to the bottom of the “page”.
Citation labels contain alphanumerics, underlines, hyphens and fullstops. Case is not significant. Given a citation like [this], one can also refer to it like this.
|
||||||||
External hyperlinks, like Python_.
.. _Python: http://www.python.org/
|
External hyperlinks, like Python. | ||||||||
External hyperlinks, like `Python
<http://www.python.org/>`_.
|
External hyperlinks, like Python. | ||||||||
Internal crossreferences, like example_.
.. _example:
This is an example crossreference target.
|
Internal crossreferences, like example. This is an example crossreference target. |
||||||||
Python_ is `my favourite
programming language`__.
.. _Python: http://www.python.org/
__ Python_
|
Python is my favourite programming language. | ||||||||
Titles are targets, too
=======================
Implict references, like `Titles are targets, too`_.
|
Titles are targets, too Implict references, like Titles are targets, too. |
||||||||
Directives are a general-purpose extension mechanism, a way of adding support for new constructs without adding new syntax. For a description of all standard directives, see reStructuredText Directives (http://is.gd/2Ecqh). | |||||||||
For instance:
.. image:: magnetic-balls.jpg
:width: 40pt
|
For instance: |
||||||||
Substitutions are like inline directives, allowing graphics and arbitrary constructs within text. | |||||||||
The |biohazard| symbol must be used on containers used to
dispose of medical waste.
.. |biohazard| image:: biohazard.png
:align: middle
:width: 12
|
The symbol must be used on containers used to dispose of medical waste. | ||||||||
Any text which begins with an explicit markup start but doesn’t use the syntax of any of the constructs above, is a comment. | |||||||||
.. This text will not be shown
(but, for instance, in HTML might be
rendered as an HTML comment)
|
|||||||||
An "empty comment" does not
consume following blocks.
(An empty comment is ".." with
blank lines before and after.)
..
So this block is not "lost",
despite its indentation.
|
An “empty comment” does not consume following blocks. (An empty comment is ”..” with blank lines before and after.)
|
Credits¶
-
class
tablacreditos
¶
CP Font from LiquiType: | http://www.liquitype.com/workshop/type_design/cp-mono |
Magnetic Balls V2 image by fdecomite: | http://www.flickr.com/photos/fdecomite/2926556794/ |
Sponsored by Net Managers | http://www.netmanagers.com.ar |
Typeset using rst2pdf | http://rst2pdf.googlecode.com |