RST Primer
Native Markup
Paragraphs
And the Lord spake, saying, 'First shalt thou take out the Holy Pin.
Then, shalt thou count to three. No more. No less. Three shalt be the
number thou shalt count, and the number of the counting shall be
three. Four shalt thou not count, neither count thou two, excepting
that thou then proceed to three. Five is right out. Once at the number
three, being the third number be reached, then, lobbest thou thy Holy
Hand Grenade of Antioch towards thy foe, who, being naughty in My
sight, shall snuff it.'
And the Lord spake, saying, 'First shalt thou take out the Holy Pin. Then, shalt thou count to three. No more. No less. Three shalt be the number thou shalt count, and the number of the counting shall be three. Four shalt thou not count, neither count thou two, excepting that thou then proceed to three. Five is right out. Once at the number three, being the third number be reached, then, lobbest thou thy Holy Hand Grenade of Antioch towards thy foe, who, being naughty in My sight, shall snuff it.'
Inline markup
*text*
**text**
``text``
thisis\ *one*\ word
text
text
text
thisisoneword
Lists
* This is a bulleted list.
* It has two items, the second
item uses two lines
* nested list
* with some subitems
* parent list continues
#. Numbered list
#. with two items
10. I'll tell thee everything I can:
#. There's little to relate.
#. I saw an aged aged man,
#. A-sitting on a gate.
#. "Who are you, aged man?" I said,
#. "And how is it you live?"
#. And his answer trickled through my head,
#. Like water through a sieve.
i. He said "I look for butterflies
#. That sleep among the wheat:
#. I make them into mutton-pies,
#. And sell them in the street.
#. I sell them unto men," he said,
#. "Who sail on stormy seas;
#. And that's the way I get my bread—
#. A trifle, if you please.
This is a bulleted list.
It has two items, the second item uses two lines
nested list
with some subitems
parent list continues
Numbered list
with two items
I'll tell thee everything I can:
There's little to relate.
I saw an aged aged man,
A-sitting on a gate.
"Who are you, aged man?" I said,
"And how is it you live?"
And his answer trickled through my head,
Like water through a sieve.
He said "I look for butterflies
That sleep among the wheat:
I make them into mutton-pies,
And sell them in the street.
I sell them unto men," he said,
"Who sail on stormy seas;
And that's the way I get my bread—
A trifle, if you please.
Definition List
**term** (up to a line of text)
Definition of the text must be indented
another term
and the description
- term (up to a line of text)
Definition of the text must be indented
another term and the description
Quoted paragraph
The instructions for the use of the Holly Grenade of Antioch
And the Lord spake, saying, 'First shalt thou take out the Holy Pin. Then,
shalt thou count to three. No more. No less. Three shalt be the number
thou shalt count, and the number of the counting shall be three. Four
shalt thou not count, neither count thou two, excepting that thou then
proceed to three. Five is right out. Once at the number three, being the
third number be reached, then, lobbest thou thy Holy Hand Grenade of
Antioch towards thy foe, who, being naughty in My sight, shall snuff it.'
The original version
The instructions for the use of the Holly Grenade of Antioch
And the Lord spake, saying, 'First shalt thou take out the Holy Pin. Then, shalt thou count to three. No more. No less. Three shalt be the number thou shalt count, and the number of the counting shall be three. Four shalt thou not count, neither count thou two, excepting that thou then proceed to three. Five is right out. Once at the number three, being the third number be reached, then, lobbest thou thy Holy Hand Grenade of Antioch towards thy foe, who, being naughty in My sight, shall snuff it.'
The original version
Line Block
| I'll tell thee everything I can:
| There's little to relate.
| I saw an aged aged man,
| A-sitting on a gate.
| "Who are you, aged man?" I said,
| "And how is it you live?"
| And his answer trickled through my head,
| Like water through a sieve.
Tables
Grid Tables
Header row, column 1 (header rows optional) |
Header 2 |
Header 3 |
Header 4 |
|---|---|---|---|
body row 1, column 1 |
column 2 |
column 3 |
column 4 |
body row 2 |
... |
... |
Simple Tables
A |
B |
A and B |
|---|---|---|
False |
False |
False |
True |
False |
False |
False |
True |
False |
True |
True |
True |
CSV Tables
Treat |
Quantity |
Description |
|---|---|---|
Albatross |
2.99 |
On a stick! |
Crunchy Frog |
1.49 |
If we took the bones out, it wouldn't be crunchy, now would it? |
Gannet Ripple |
1.99 |
On a stick! |
List Tables
Treat |
Quantity |
Description |
|---|---|---|
Albatross |
2.99 |
On a stick! |
Crunchy Frog |
1.49 |
If we took the bones out, it wouldn't be crunchy, now would it? |
Gannet Ripple |
1.99 |
On a stick! |
Table with a title
A |
not A |
|---|---|
False |
True |
True |
False |
Hyperlinks
text
Named
This is a paragraph that contains a link. And one more to the cooking.
Anonymous
Sphinx reStructured Text primer
Anonymous
Sections
text
Todo
This needs attention:
| L1 Section ##########
| L2 Section **********
| L3 Section ==========
| L4 Section -----------
| L5 Section ^^^^^^^^^^^
| L6 Section """""""""""
Roles
text
italics
bold
literal
X subscript
X superscript
title-reference
Images
text
Substitutions
Longer text with replacement text in it.
Admonitions
text
Lemon Curry
text
Attention
OTHER
Caution
replacement text
Danger
text
Error
text
Hint
text
Important
text
Note
text
Tip
text
Warning
text
code-block
print("hello world")
1@ECHO OFF
2
3pushd %~dp0
4
5REM Command file for Sphinx documentation
6
7if "%SPHINXBUILD%" == "" (
8 set SPHINXBUILD=sphinx-build
9)
10set SOURCEDIR=source
11set BUILDDIR=build
12
13%SPHINXBUILD% >NUL 2>NUL
14if errorlevel 9009 (
15 echo.
16 echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17 echo.installed, then set the SPHINXBUILD environment variable to point
18 echo.to the full path of the 'sphinx-build' executable. Alternatively you
19 echo.may add the Sphinx directory to PATH.
20 echo.
21 echo.If you don't have Sphinx installed, grab it from
22 echo.https://www.sphinx-doc.org/
23 exit /b 1
24)
25
26if "%1" == "" goto help
27
28%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29goto end
30
31:help
32%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33
34:end
35popd
Footnotes & Citations
And the Lord spake, saying, 'First shalt thou take out the Holy Pin. Then, shalt thou [1] count to three. No more. No less. Three shalt be the number thou shalt count, and the number of the counting shall be three. Four shalt thou not count, neither [2] count thou two, excepting that thou then proceed to three. Five [Pears] is right out. Once at the number three, being the third number be reached, then, lobbest thou thy Holy Hand Grenade of Antioch towards thy foe, who, being naughty in My sight, shall snuff it.'
Pears, R. and Shields, G. (2019) Cite them right: The essential referencing guide. 11th edn. London: MacMillan
Extended Markup
Collapse
.. collapse:: text
.. literalinclude:: _static/test.py
.. graphviz::
# "I played some days with making an interface between our ConceptBase
# system (essentially a database system to store models) and graphviz. One
# example graph is attached. It is a so-called petri net for Dutch traffic
# lights. The example is actually taken from a book by Wil van der Aalst."
# Contributed by Manfred Jeusfeld.
##Command to produce the output: "neato -Tpng thisfile > thisfile.png"
digraph TrafficLights {
fontname="Helvetica,Arial,sans-serif"
node [fontname="Helvetica,Arial,sans-serif"]
edge [fontname="Helvetica,Arial,sans-serif"]
layout = neato
node [shape=box]; gy2; yr2; rg2; gy1; yr1; rg1;
node [shape=circle,fixedsize=true,width=0.9]; green2; yellow2; red2; safe2; safe1; green1; yellow1; red1;
gy2->yellow2;
rg2->green2;
yr2->safe1;
yr2->red2;
safe2->rg2;
green2->gy2;
yellow2->yr2;
red2->rg2;
gy1->yellow1;
rg1->green1;
yr1->safe2;
yr1->red1;
safe1->rg1;
green1->gy1;
yellow1->yr1;
red1->rg1;
overlap=false
label="PetriNet Model TrafficLights\nExtracted from ConceptBase and layed out by Graphviz"
fontsize=12;
}
text
import this
print("hello")
![# "I played some days with making an interface between our ConceptBase
# system (essentially a database system to store models) and graphviz. One
# example graph is attached. It is a so-called petri net for Dutch traffic
# lights. The example is actually taken from a book by Wil van der Aalst."
# Contributed by Manfred Jeusfeld.
##Command to produce the output: "neato -Tpng thisfile > thisfile.png"
digraph TrafficLights {
fontname="Helvetica,Arial,sans-serif"
node [fontname="Helvetica,Arial,sans-serif"]
edge [fontname="Helvetica,Arial,sans-serif"]
layout = neato
node [shape=box]; gy2; yr2; rg2; gy1; yr1; rg1;
node [shape=circle,fixedsize=true,width=0.9]; green2; yellow2; red2; safe2; safe1; green1; yellow1; red1;
gy2->yellow2;
rg2->green2;
yr2->safe1;
yr2->red2;
safe2->rg2;
green2->gy2;
yellow2->yr2;
red2->rg2;
gy1->yellow1;
rg1->green1;
yr1->safe2;
yr1->red1;
safe1->rg1;
green1->gy1;
yellow1->yr1;
red1->rg1;
overlap=false
label="PetriNet Model TrafficLights\nExtracted from ConceptBase and layed out by Graphviz"
fontsize=12;
}](_images/graphviz-9a092a558885540685595cea4eff2161260cc114.png)
Graphviz
Graph

Digraph

![digraph {
rankdir = LR
h [label="Hello", shape=square, color="#ffffaf", style="rounded,filled"]
w [label=World, shape=egg]
h -> w [color=orange, penwidth=2, label=x]
}](_images/graphviz-ff86be0e1b434091181a69be8310151191840b12.png)
![digraph {
splines=ortho
node [ shape=record, style=rounded]
rankdir=LR
s1 [
label= "a|b|<p1>c"
]
s2 [
label= "<p1>a|{<p2>b1|<p3>b2}|<p4>c"
]
s1:p1 -> s2:p1 [label=1]
s2:p4 -> s2:p2 [label=Q, radius=10]
}](_images/graphviz-9164be9f979d429b85d97f28c0d3306d7bd84519.png)
![graph G {
layout=neato;
node [shape=circle];
A [pos="0,0!"];
B [pos="2,0!"];
C [pos="1,2!"];
D [pos="1,1!"];
}](_images/graphviz-3808085240638836621f0e46d33b56022249bfb6.png)
![digraph{
node [
style=filled,
fillcolor="#66aaff",
color="#0044aa",
shape=folder,
style="rounded,filled",
height=0.5,
penwidth=2,
fixedsize=false
]
local_static [label="~/Projects/Documentation/\*\*"]
local_dynamic [label="~/Projects/Active/django-tutorial/"]
server_docs [label="/var/www/docs/"]
server_static [label="/var/www/static"]
server_dynamic [label="/srv/hermes/"]
node [
style=filled,
fillcolor="#00aa22",
color="#004422",
shape=egg,
style="rounded,filled",
height=0.5,
penwidth=2,
fixedsize=false
]
browser [label="Browser"]
node [
style=filled,
fillcolor="#ffaa00",
color="#ff4400",
shape=cds,
style="rounded,filled",
height=0.5,
penwidth=2,
fixedsize=false
]
socket [label="/run/socket.sock"]
subgraph cluster_local {
label="Elmer";
local_dynamic;
local_static;
}
subgraph cluster_server {
label="Hermes";
server_static;
server_docs;
server_dynamic;
socket;
}
{ local_static,
local_dynamic,
server_docs,
server_static,
socket
} -> browser
server_dynamic -> socket;
server_dynamic -> server_static;
local_dynamic -> server_dynamic;
local_static -> server_docs;
}](_images/graphviz-f73def890e9e4745dd9cf9bf3cbd7b9d17220928.png)
![digraph {
compound=true
node [ fontname="Handlee" ];
subgraph cluster_frontend {
label="Frontend";
React;
Bootstrap;
}
subgraph cluster_backend {
label="Backend";
expressjs;
"aws-sdk";
}
React -> expressjs [ltail=cluster_frontend];
expressjs -> "aws-sdk" [constraint=false];
}](_images/graphviz-98aa45a9d91514eb3ec44fca0cb7bfd5941dc44a.png)