| 1 |
.. |
| 2 |
Copyright (c) 2021 Pradyun Gedam |
| 3 |
Licensed under Creative Commons Attribution-ShareAlike 4.0 International License |
| 4 |
SPDX-License-Identifier: CC-BY-SA-4.0 |
| 5 |
|
| 6 |
.. |EXAMPLE| image:: https://picsum.photos/16/16 |
| 7 |
:width: 1em |
| 8 |
|
| 9 |
============= |
| 10 |
Generic items |
| 11 |
============= |
| 12 |
|
| 13 |
These are the things that don't quite fit into other groupings. |
| 14 |
|
| 15 |
Inline Markup |
| 16 |
============= |
| 17 |
|
| 18 |
One of the nice things about markup languages is the ability to have inline |
| 19 |
markup. This makes the presentation *much* nicer. The **bold** text shouldn't |
| 20 |
be too overbearing. It is very common to have ``inline code`` as well. It is |
| 21 |
important to ensure that the inline code doesn't have a line height that is |
| 22 |
greater than the regular prose; otherwise the spacing looks weird. |
| 23 |
|
| 24 |
It is also possible to use explicit roles to do things like a :sub:`subscript`, |
| 25 |
a :sup:`superscript`, :emphasis:`emphasis`, :strong:`strong`, and |
| 26 |
:literal:`literal`. |
| 27 |
|
| 28 |
Hyperlinks |
| 29 |
---------- |
| 30 |
|
| 31 |
It is a website, so it'll have hyperlinks like https://www.python.org/ (inline), |
| 32 |
or Python_ (external reference), example_ (internal reference), |
| 33 |
`Python web site <https://www.python.org/>`__ (external hyperlinks with embedded |
| 34 |
URI), footnote references (manually numbered [1]_, anonymous auto-numbered [#]_, |
| 35 |
labeled auto-numbered [#label]_, or symbolic [*]_), citation references ([12]_), |
| 36 |
substitution references (|example|), and _`inline hyperlink targets` |
| 37 |
(see Targets_ below for a reference back to here). |
| 38 |
|
| 39 |
reStructuredText has character-level inline markup too. It's ugly to write, but |
| 40 |
someone might be using it, so here's an example: **re**\ ``Structured``\ *Text*. |
| 41 |
|
| 42 |
It is also possible to link to documented items, such as |
| 43 |
:class:`api_sample.RandomNumberGenerator`. |
| 44 |
|
| 45 |
Interpreted text |
| 46 |
---------------- |
| 47 |
|
| 48 |
The default role for "interpreted text" (AKA single backticks) is |
| 49 |
`Title Reference`. There are other reference syntaxes as well: :PEP:`287` and |
| 50 |
:RFC:`2822`. |
| 51 |
|
| 52 |
If the ``--pep-references`` option was supplied, there should be a live link to |
| 53 |
PEP 258 here. |
| 54 |
|
| 55 |
GUI labels |
| 56 |
^^^^^^^^^^ |
| 57 |
|
| 58 |
According to the RST demo, GUI labels (like :guilabel:`this label`) are a way to |
| 59 |
indicate that some action is to be taken by the user. Like inline code literals, |
| 60 |
GUI labels should not run over line height. |
| 61 |
|
| 62 |
Keys / Menu labels |
| 63 |
^^^^^^^^^^^^^^^^^^ |
| 64 |
|
| 65 |
Key-bindings indicate that the read is to press a button on the keyboard or |
| 66 |
mouse, for example :kbd:`MMB`, :kbd:`⌘+⇧+M` and :kbd:`Shift-MMB`. Another |
| 67 |
useful way is ``menuselection`` to show menus: |
| 68 |
:menuselection:`My --> Software --> Some menu --> Some sub menu 1 --> Some sub menu 2 --> Some sub menu 3` |
| 69 |
|
| 70 |
For example, ``menuselection`` should break when it is too long to fit on a |
| 71 |
single line. |
| 72 |
|
| 73 |
Long inline code wrapping |
| 74 |
^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 75 |
|
| 76 |
.. DO NOT RE-WRAP THE FOLLOWING PARAGRAPH! |
| 77 |
|
| 78 |
Let's test wrapping and whitespace significance in inline literals: |
| 79 |
``This is an example of --inline-literal --text, --including some-- |
| 80 |
strangely--hyphenated-words. Adjust-the-width-of-your-browser-window |
| 81 |
to see how the text is wrapped. -- ---- -------- Now note the |
| 82 |
spacing between the words of this sentence (words |
| 83 |
should be grouped in pairs).`` |
| 84 |
|
| 85 |
Math |
| 86 |
==== |
| 87 |
|
| 88 |
This is a test. Here is an equation: |
| 89 |
:math:`X_{0:5} = (X_0, X_1, X_2, X_3, X_4)`. |
| 90 |
Here is another: |
| 91 |
|
| 92 |
.. math:: |
| 93 |
:label: This is a label |
| 94 |
|
| 95 |
\nabla^2 f = |
| 96 |
\frac{1}{r^2} \frac{\partial}{\partial r} |
| 97 |
\left( r^2 \frac{\partial f}{\partial r} \right) + |
| 98 |
\frac{1}{r^2 \sin \theta} \frac{\partial f}{\partial \theta} |
| 99 |
\left( \sin \theta \, \frac{\partial f}{\partial \theta} \right) + |
| 100 |
\frac{1}{r^2 \sin^2\theta} \frac{\partial^2 f}{\partial \phi^2} |
| 101 |
|
| 102 |
You can add a link to equations like the one above :eq:`This is a label` by using |
| 103 |
``:eq:``. |
| 104 |
|
| 105 |
|
| 106 |
Sidebar |
| 107 |
======= |
| 108 |
|
| 109 |
.. sidebar:: Ch'ien / The Creative |
| 110 |
|
| 111 |
Lorem ipsum dolor sit amet consectetur adipisicing elit. |
| 112 |
|
| 113 |
.. image:: https://picsum.photos/200/200 |
| 114 |
|
| 115 |
Lorem ipsum dolor sit amet consectetur adipisicing elit. |
| 116 |
|
| 117 |
Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusamus, sunt |
| 118 |
voluptatum tenetur libero nulla esse veritatis accusantium earum commodi hic |
| 119 |
voluptatem officia culpa optio atque. Quaerat sed quibusdam ratione nam. |
| 120 |
|
| 121 |
Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusamus, sunt |
| 122 |
voluptatum tenetur libero nulla esse veritatis accusantium earum commodi hic |
| 123 |
voluptatem officia culpa optio atque. Quaerat sed quibusdam ratione nam. |
| 124 |
|
| 125 |
Code with Sidebar |
| 126 |
----------------- |
| 127 |
|
| 128 |
.. sidebar:: A code example |
| 129 |
|
| 130 |
With a sidebar on the right. |
| 131 |
|
| 132 |
.. code-block:: python |
| 133 |
:caption: Code blocks can also have captions. |
| 134 |
:linenos: |
| 135 |
|
| 136 |
print("one") |
| 137 |
print("two") |
| 138 |
print("three") |
| 139 |
print("four") |
| 140 |
print("five") |
| 141 |
print("six") |
| 142 |
print("seven") |
| 143 |
print("eight") |
| 144 |
print("nine") |
| 145 |
print("ten") |
| 146 |
print("eleven") |
| 147 |
print("twelve") |
| 148 |
print("thirteen") |
| 149 |
print("fourteen") |
| 150 |
|
| 151 |
References |
| 152 |
========== |
| 153 |
|
| 154 |
Footnotes |
| 155 |
--------- |
| 156 |
|
| 157 |
.. [1] A footnote contains body elements, consistently indented by at |
| 158 |
least 3 spaces. |
| 159 |
|
| 160 |
This is the footnote's second paragraph. |
| 161 |
|
| 162 |
.. [#label] Footnotes may be numbered, either manually (as in [1]_) or |
| 163 |
automatically using a "#"-prefixed label. This footnote has a |
| 164 |
label so it can be referred to from multiple places, both as a |
| 165 |
footnote reference ([#label]_) and as a hyperlink reference |
| 166 |
(label_). |
| 167 |
|
| 168 |
.. [#] This footnote is numbered automatically and anonymously using a |
| 169 |
label of "#" only. |
| 170 |
|
| 171 |
.. [*] Footnotes may also use symbols, specified with a "*" label. |
| 172 |
Here's a reference to the next footnote: [*]_. |
| 173 |
|
| 174 |
.. [*] This footnote shows the next symbol in the sequence. |
| 175 |
|
| 176 |
Citations |
| 177 |
--------- |
| 178 |
|
| 179 |
.. [12] This citation has some ``code blocks`` in it, maybe some **bold** and |
| 180 |
*italics* too. Heck, lets put a link to a meta citation [13]_ too. |
| 181 |
|
| 182 |
.. [13] This citation will have one backlink. |
| 183 |
|
| 184 |
Here's a reference to the above, [12]_ citation. |
| 185 |
|
| 186 |
Here is another type of citation: `citation` |
| 187 |
|
| 188 |
Targets |
| 189 |
------- |
| 190 |
|
| 191 |
.. _example: |
| 192 |
|
| 193 |
This paragraph is pointed to by the explicit "example" target. |
| 194 |
A reference can be found under `Inline Markup`_, above. `Inline |
| 195 |
hyperlink targets`_ are also possible. |
| 196 |
|
| 197 |
Section headers are implicit targets, referred to by name. See |
| 198 |
Targets_. |
| 199 |
|
| 200 |
Explicit external targets are interpolated into references such as "Python_". |
| 201 |
|
| 202 |
.. _Python: https://www.python.org/ |
| 203 |
|
| 204 |
Targets may be indirect and anonymous. Thus `this phrase`__ may also |
| 205 |
refer to the Targets_ section. |
| 206 |
|
| 207 |
__ Targets_ |
| 208 |
|
| 209 |
Target Footnotes |
| 210 |
---------------- |
| 211 |
|
| 212 |
.. target-notes:: |
| 213 |
|
| 214 |
Centered text |
| 215 |
============= |
| 216 |
|
| 217 |
You can create a statement with centered text with ``.. centered::`` |
| 218 |
|
| 219 |
.. centered:: This is centered text! |
| 220 |
|
| 221 |
Rubric |
| 222 |
====== |
| 223 |
|
| 224 |
A rubric is like an informal heading that doesn't correspond to the document's structure. |
| 225 |
|
| 226 |
-- https://docutils.sourceforge.io/docs/ref/rst/directives.html#rubric |
| 227 |
|
| 228 |
Wikipedia says it is something different: |
| 229 |
|
| 230 |
A rubric is a word or section of text that is traditionally written or printed in red ink for emphasis. |
| 231 |
|
| 232 |
-- https://en.wikipedia.org/wiki/Rubric |
| 233 |
|
| 234 |
This is stylized as docutils tells us to stylize it, since it is used for footnote headers (see end of https://docs.python.org/3/reference/lexical_analysis.html) |
| 235 |
|
| 236 |
.. rubric:: This is a rubric |
| 237 |
|
| 238 |
Sidebars and Rubrics |
| 239 |
-------------------- |
| 240 |
|
| 241 |
.. sidebar:: Sidebar Title |
| 242 |
:subtitle: Optional Subtitle |
| 243 |
|
| 244 |
This is a sidebar. It is for text outside the flow of the main |
| 245 |
text. |
| 246 |
|
| 247 |
.. rubric:: This is a rubric inside a sidebar |
| 248 |
|
| 249 |
Sidebars often appears beside the main text with a border and |
| 250 |
background color. |
| 251 |
|
| 252 |
Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusamus, sunt |
| 253 |
voluptatum tenetur libero nulla esse veritatis accusantium earum commodi hic |
| 254 |
voluptatem officia culpa optio atque. Quaerat sed quibusdam ratione nam. |
| 255 |
|
| 256 |
Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusamus, sunt |
| 257 |
voluptatum tenetur libero nulla esse veritatis accusantium earum commodi hic |
| 258 |
voluptatem officia culpa optio atque. Quaerat sed quibusdam ratione nam. |
| 259 |
|
| 260 |
Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusamus, sunt |
| 261 |
voluptatum tenetur libero nulla esse veritatis accusantium earum commodi hic |
| 262 |
voluptatem officia culpa optio atque. Quaerat sed quibusdam ratione nam. |
| 263 |
|
| 264 |
Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusamus, sunt |
| 265 |
voluptatum tenetur libero nulla esse veritatis accusantium earum commodi hic |
| 266 |
voluptatem officia culpa optio atque. Quaerat sed quibusdam ratione nam. |
| 267 |
|
| 268 |
Download Links |
| 269 |
============== |
| 270 |
|
| 271 |
:download:`This long long long long long long long long long long long long long long long download link should wrap white-spaces <https://picsum.photos/200/200>` |