| 1 |
.. This is a comment. Note how any initial comments are moved by |
| 2 |
transforms to after the document title, subtitle, and docinfo. |
| 3 |
|
| 4 |
.. demo.rst from: http://docutils.sourceforge.net/docs/user/rst/demo.txt |
| 5 |
|
| 6 |
.. |EXAMPLE| image:: static/yi_jing_01_chien.jpg |
| 7 |
:width: 1em |
| 8 |
|
| 9 |
********************** |
| 10 |
Paragraph Level Markup |
| 11 |
********************** |
| 12 |
|
| 13 |
.. contents:: Table of Contents |
| 14 |
|
| 15 |
Inline Markup |
| 16 |
============= |
| 17 |
|
| 18 |
Paragraphs contain text and may contain inline markup: *emphasis*, **strong emphasis**, ``inline literals``, |
| 19 |
standalone hyperlinks (http://www.python.org), external hyperlinks (Python_), internal cross-references (example_), |
| 20 |
external hyperlinks with embedded URIs (`Python web site <http://www.python.org>`__), footnote references |
| 21 |
(manually numbered [1]_, anonymous auto-numbered [#]_, labeled auto-numbered [#label]_, or symbolic [*]_), |
| 22 |
citation references ([12]_), substitution references (|example|), and _`inline hyperlink targets` |
| 23 |
(see Targets_ below for a reference back to here). Character-level inline markup is also possible |
| 24 |
(although exceedingly ugly!) in *re*\ ``Structured``\ *Text*. Problems are indicated by |problematic| |
| 25 |
text (generated by processing errors; this one is intentional). |
| 26 |
|
| 27 |
Also with ``sphinx.ext.autodoc``, which I use in the demo, I can link to :class:`test_py_module.test.Foo`. |
| 28 |
It will link you right to my code documentation for it. |
| 29 |
|
| 30 |
The default role for [1]_ interpreted text is `Title Reference`. Here are some explicit interpreted text roles: |
| 31 |
a PEP reference (:PEP:`287`); an RFC reference (:RFC:`2822`); a :sub:`subscript`; a :sup:`superscript`; |
| 32 |
and explicit roles for :emphasis:`standard` :strong:`inline` :literal:`markup`. |
| 33 |
|
| 34 |
GUI labels are a useful way to indicate that :guilabel:`Some action` is to be taken by the user. |
| 35 |
The GUI label should not run over ``line-height`` so as not to :guilabel:`interfere` with text from adjacent lines. |
| 36 |
|
| 37 |
Key-bindings indicate that [1]_ the read is to press a button on the keyboard or mouse, |
| 38 |
for example :kbd:`MMB` and :kbd:`Shift-MMB`. Another useful markup to indicate a user action |
| 39 |
is to use ``menuselection`` this [1]_ can [1]_ be [1]_ used [1]_ to [1]_ show [1]_ short [1]_ and long menus in software. |
| 40 |
For example, and ``menuselection`` can be seen here that breaks is too long to fit on this line. |
| 41 |
:menuselection:`My --> Software --> Some menu --> Some sub menu 1 --> sub menu 2`. |
| 42 |
|
| 43 |
.. DO NOT RE-WRAP THE FOLLOWING PARAGRAPH! |
| 44 |
|
| 45 |
Let's test wrapping and whitespace significance in inline literals: |
| 46 |
``This is an example of --inline-literal --text, --including some-- |
| 47 |
strangely--hyphenated-words. Adjust-the-width-of-your-browser-window |
| 48 |
to see how the text is wrapped. -- ---- -------- Now note the |
| 49 |
spacing between the words of this sentence (words |
| 50 |
should be grouped in pairs).`` |
| 51 |
|
| 52 |
If the ``--pep-references`` option was supplied, there should be a live link to PEP 258 here. |
| 53 |
|
| 54 |
.. regression test for https://github.com/readthedocs/sphinx_rtd_theme/pull/1193 |
| 55 |
|
| 56 |
Very long URLs should be wrapped so lines do not overflow and cause horizontal scrolling: https://www.google.com/search?hl=en&q=very%20long%20url%20example%20of%20a%20url%20that%20is%20extremely%20long%20you%20probably%20want%20to%20avoid%20it%20but%20here%20we%20are |
| 57 |
|
| 58 |
Math |
| 59 |
==== |
| 60 |
|
| 61 |
This is a test. Here is an equation: |
| 62 |
:math:`X_{0:5} = (X_0, X_1, X_2, X_3, X_4)`. |
| 63 |
Here is another: |
| 64 |
|
| 65 |
.. math:: |
| 66 |
:label: This is a label |
| 67 |
|
| 68 |
\nabla^2 f = |
| 69 |
\frac{1}{r^2} \frac{\partial}{\partial r} |
| 70 |
\left( r^2 \frac{\partial f}{\partial r} \right) + |
| 71 |
\frac{1}{r^2 \sin \theta} \frac{\partial f}{\partial \theta} |
| 72 |
\left( \sin \theta \, \frac{\partial f}{\partial \theta} \right) + |
| 73 |
\frac{1}{r^2 \sin^2\theta} \frac{\partial^2 f}{\partial \phi^2} |
| 74 |
|
| 75 |
You can add a link to equations like the one above :eq:`This is a label` by using ``:eq:``. |
| 76 |
|
| 77 |
Meta |
| 78 |
==== |
| 79 |
|
| 80 |
.. meta:: |
| 81 |
:keywords: reStructuredText, demonstration, demo, parser |
| 82 |
:description lang=en: A demonstration of the reStructuredText |
| 83 |
markup language, containing examples of all basic |
| 84 |
constructs and many advanced constructs. |
| 85 |
|
| 86 |
Blocks |
| 87 |
====== |
| 88 |
|
| 89 |
Literal Blocks |
| 90 |
-------------- |
| 91 |
|
| 92 |
Literal blocks are indicated with a double-colon ("::") at the end of |
| 93 |
the preceding paragraph (over there ``-->``). They can be indented:: |
| 94 |
|
| 95 |
if literal_block: |
| 96 |
text = 'is left as-is' |
| 97 |
spaces_and_linebreaks = 'are preserved' |
| 98 |
markup_processing = None |
| 99 |
|
| 100 |
Or they can be quoted without indentation:: |
| 101 |
|
| 102 |
>> Great idea! |
| 103 |
> |
| 104 |
> Why didn't I think of that? |
| 105 |
|
| 106 |
Line Blocks |
| 107 |
----------- |
| 108 |
|
| 109 |
| This is a line block. It ends with a blank line. |
| 110 |
| Each new line begins with a vertical bar ("|"). |
| 111 |
| Line breaks and initial indents are preserved. |
| 112 |
| Continuation lines are wrapped portions of long lines; |
| 113 |
they begin with a space in place of the vertical bar. |
| 114 |
| The left edge of a continuation line need not be aligned with |
| 115 |
the left edge of the text above it. |
| 116 |
|
| 117 |
| This is a second line block. |
| 118 |
| |
| 119 |
| Blank lines are permitted internally, but they must begin with a "|". |
| 120 |
|
| 121 |
Take it away, Eric the Orchestra Leader! |
| 122 |
|
| 123 |
| A one, two, a one two three four |
| 124 |
| |
| 125 |
| Half a bee, philosophically, |
| 126 |
| must, *ipso facto*, half not be. |
| 127 |
| But half the bee has got to be, |
| 128 |
| *vis a vis* its entity. D'you see? |
| 129 |
| |
| 130 |
| But can a bee be said to be |
| 131 |
| or not to be an entire bee, |
| 132 |
| when half the bee is not a bee, |
| 133 |
| due to some ancient injury? |
| 134 |
| |
| 135 |
| Singing... |
| 136 |
|
| 137 |
Block Quotes |
| 138 |
------------ |
| 139 |
|
| 140 |
Block quotes consist of indented body elements: |
| 141 |
|
| 142 |
My theory by A. Elk. Brackets Miss, brackets. This theory goes |
| 143 |
as follows and begins now. All brontosauruses are thin at one |
| 144 |
end, much much thicker in the middle and then thin again at the |
| 145 |
far end. That is my theory, it is mine, and belongs to me and I |
| 146 |
own it, and what it is too. |
| 147 |
|
| 148 |
-- Anne Elk (Miss) |
| 149 |
|
| 150 |
Doctest Blocks |
| 151 |
-------------- |
| 152 |
|
| 153 |
>>> print 'Python-specific usage examples; begun with ">>>"' |
| 154 |
Python-specific usage examples; begun with ">>>" |
| 155 |
>>> print '(cut and pasted from interactive Python sessions)' |
| 156 |
(cut and pasted from interactive Python sessions) |
| 157 |
|
| 158 |
Code Blocks |
| 159 |
----------- |
| 160 |
|
| 161 |
.. parsed-literal:: |
| 162 |
|
| 163 |
# parsed-literal test |
| 164 |
curl -O http://someurl/release-|version|.tar-gz |
| 165 |
|
| 166 |
|
| 167 |
.. code-block:: json |
| 168 |
:caption: Code Blocks can have captions. |
| 169 |
|
| 170 |
{ |
| 171 |
"windows": [ |
| 172 |
{ |
| 173 |
"panes": [ |
| 174 |
{ |
| 175 |
"shell_command": [ |
| 176 |
"echo 'did you know'", |
| 177 |
"echo 'you can inline'" |
| 178 |
] |
| 179 |
}, |
| 180 |
{ |
| 181 |
"shell_command": "echo 'single commands'" |
| 182 |
}, |
| 183 |
"echo 'for panes'" |
| 184 |
], |
| 185 |
"window_name": "long form" |
| 186 |
} |
| 187 |
], |
| 188 |
"session_name": "shorthands" |
| 189 |
} |
| 190 |
|
| 191 |
Emphasized lines with line numbers |
| 192 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 193 |
|
| 194 |
.. code-block:: python |
| 195 |
:linenos: |
| 196 |
:emphasize-lines: 3,5 |
| 197 |
|
| 198 |
def some_function(): |
| 199 |
interesting = False |
| 200 |
print 'This line is highlighted.' |
| 201 |
print 'This one is not...' |
| 202 |
print '...but this one is.' |
| 203 |
|
| 204 |
Sidebar |
| 205 |
======= |
| 206 |
|
| 207 |
.. sidebar:: Ch'ien / The Creative |
| 208 |
|
| 209 |
.. image:: static/yi_jing_01_chien.jpg |
| 210 |
|
| 211 |
*Above* CH'IEN THE CREATIVE, HEAVEN |
| 212 |
|
| 213 |
*Below* CH'IEN THE CREATIVE, HEAVEN |
| 214 |
|
| 215 |
The first hexagram is made up of six unbroken lines. These unbroken lines stand for the primal power, |
| 216 |
which is light-giving, active, strong, and of the spirit. The hexagram is consistently strong in character, |
| 217 |
and since it is without weakness, its essence is power or energy. Its image is heaven. |
| 218 |
Its energy is represented as unrestricted by any fixed conditions in space and is therefore conceived of as motion. |
| 219 |
Time is regarded as the basis of this motion. |
| 220 |
Thus the hexagram includes also the power of time and the power of persisting in time, that is, duration. |
| 221 |
|
| 222 |
The power represented by the hexagram is to be interpreted in a dual sense in terms of its action |
| 223 |
on the universe and of its action on the world of men. In relation to the universe, the hexagram expresses the strong, |
| 224 |
creative action of the Deity. In relation to the human world, it denotes the creative action of the holy man or sage, |
| 225 |
of the ruler or leader of men, who through his power awakens and develops their higher nature. |
| 226 |
|
| 227 |
Code with Sidebar |
| 228 |
----------------- |
| 229 |
|
| 230 |
.. sidebar:: A code example |
| 231 |
|
| 232 |
With a sidebar on the right. |
| 233 |
|
| 234 |
.. literalinclude:: test_py_module/test.py |
| 235 |
:language: python |
| 236 |
:caption: Literal includes can also have captions. |
| 237 |
:linenos: |
| 238 |
:lines: 1-40 |
| 239 |
|
| 240 |
References |
| 241 |
========== |
| 242 |
|
| 243 |
Footnotes |
| 244 |
--------- |
| 245 |
|
| 246 |
.. [1] A footnote contains body elements, consistently indented by at |
| 247 |
least 3 spaces. |
| 248 |
|
| 249 |
This is the footnote's second paragraph. |
| 250 |
|
| 251 |
.. [#label] Footnotes may be numbered, either manually (as in [1]_) or |
| 252 |
automatically using a "#"-prefixed label. This footnote has a |
| 253 |
label so it can be referred to from multiple places, both as a |
| 254 |
footnote reference ([#label]_) and as a hyperlink reference |
| 255 |
(label_). |
| 256 |
|
| 257 |
.. [#] This footnote is numbered automatically and anonymously using a |
| 258 |
label of "#" only. |
| 259 |
|
| 260 |
.. [*] Footnotes may also use symbols, specified with a "*" label. |
| 261 |
Here's a reference to the next footnote: [*]_. |
| 262 |
|
| 263 |
.. [*] This footnote shows the next symbol in the sequence. |
| 264 |
|
| 265 |
.. [4] Here's an unreferenced footnote, with a reference to a |
| 266 |
nonexistent footnote: [5]_. |
| 267 |
|
| 268 |
Citations |
| 269 |
--------- |
| 270 |
|
| 271 |
.. [Citation] This is the citation I made, let's make this extremely long so that we can tell that it doesn't follow the normal responsive table stuff. |
| 272 |
|
| 273 |
.. [12] This citation has some ``code blocks`` in it, maybe some **bold** and |
| 274 |
*italics* too. Heck, lets put a link to a meta citation [13]_ too. |
| 275 |
|
| 276 |
.. [13] This citation will have two backlinks. |
| 277 |
|
| 278 |
|
| 279 |
Here's a reference to the above, [Citation]_, and a [nonexistent]_ citation. |
| 280 |
|
| 281 |
Glossary |
| 282 |
-------- |
| 283 |
|
| 284 |
This is a glossary with definition terms for thing like :term:`Writing`: |
| 285 |
|
| 286 |
.. glossary:: |
| 287 |
|
| 288 |
Documentation |
| 289 |
Provides users with the knowledge they need to use something. |
| 290 |
|
| 291 |
Reading |
| 292 |
The process of taking information into ones mind through the use of eyes. |
| 293 |
|
| 294 |
Writing |
| 295 |
The process of putting thoughts into a medium for other people to :term:`read <Reading>`. |
| 296 |
|
| 297 |
Targets |
| 298 |
------- |
| 299 |
|
| 300 |
.. _example: |
| 301 |
|
| 302 |
This paragraph is pointed to by the explicit "example" target. |
| 303 |
A reference can be found under `Inline Markup`_, above. `Inline |
| 304 |
hyperlink targets`_ are also possible. |
| 305 |
|
| 306 |
Section headers are implicit targets, referred to by name. See |
| 307 |
Targets_, which is a subsection of `References`_. |
| 308 |
|
| 309 |
Explicit external targets are interpolated into references such as "Python_". |
| 310 |
|
| 311 |
.. _Python: http://www.python.org/ |
| 312 |
|
| 313 |
Targets may be indirect and anonymous. Thus `this phrase`__ may also |
| 314 |
refer to the Targets_ section. |
| 315 |
|
| 316 |
__ Targets_ |
| 317 |
|
| 318 |
Here's a `hyperlink reference without a target`_, which generates an error. |
| 319 |
|
| 320 |
|
| 321 |
Directives |
| 322 |
========== |
| 323 |
|
| 324 |
Contents |
| 325 |
-------- |
| 326 |
|
| 327 |
.. contents:: :local: |
| 328 |
|
| 329 |
These are just a sample of the many reStructuredText Directives. For others, please see: |
| 330 |
http://docutils.sourceforge.net/docs/ref/rst/directives.html. |
| 331 |
|
| 332 |
|
| 333 |
Centered text |
| 334 |
------------- |
| 335 |
|
| 336 |
You can create a statement with centered text with ``.. centered::`` |
| 337 |
|
| 338 |
.. centered:: This is centered text! |
| 339 |
|
| 340 |
Images & Figures |
| 341 |
---------------- |
| 342 |
|
| 343 |
Images |
| 344 |
^^^^^^ |
| 345 |
|
| 346 |
An image directive (also clickable -- a hyperlink reference): |
| 347 |
|
| 348 |
.. image:: static/yi_jing_01_chien.jpg |
| 349 |
:target: directives_ |
| 350 |
|
| 351 |
Figures |
| 352 |
^^^^^^^ |
| 353 |
|
| 354 |
.. figure:: static/yi_jing_01_chien.jpg |
| 355 |
:alt: reStructuredText, the markup syntax |
| 356 |
|
| 357 |
A figure is an image with a caption and/or a legend: |
| 358 |
|
| 359 |
+------------+-----------------------------------------------+ |
| 360 |
| re | Revised, revisited, based on 're' module. | |
| 361 |
+------------+-----------------------------------------------+ |
| 362 |
| Structured | Structure-enhanced text, structuredtext. | |
| 363 |
+------------+-----------------------------------------------+ |
| 364 |
| Text | Well it is, isn't it? | |
| 365 |
+------------+-----------------------------------------------+ |
| 366 |
|
| 367 |
This paragraph is also part of the legend. |
| 368 |
|
| 369 |
A figure directive with center alignment |
| 370 |
|
| 371 |
.. figure:: static/yi_jing_01_chien.jpg |
| 372 |
:align: center |
| 373 |
|
| 374 |
This caption should be centered. |
| 375 |
|
| 376 |
Admonitions |
| 377 |
----------- |
| 378 |
|
| 379 |
.. Attention:: Directives at large. |
| 380 |
|
| 381 |
.. Caution:: Don't take any wooden nickels. |
| 382 |
|
| 383 |
.. DANGER:: Mad scientist at work! |
| 384 |
|
| 385 |
.. Error:: Does not compute. |
| 386 |
|
| 387 |
.. Hint:: It's bigger than a bread box. |
| 388 |
|
| 389 |
.. Important:: |
| 390 |
- Wash behind your ears. |
| 391 |
- Clean up your room. |
| 392 |
|
| 393 |
- Including the closet. |
| 394 |
- The bathroom too. |
| 395 |
|
| 396 |
- Take the trash out of the bathroom. |
| 397 |
- Clean the sink. |
| 398 |
- Call your mother. |
| 399 |
- Back up your data. |
| 400 |
|
| 401 |
.. Note:: This is a note. |
| 402 |
Equations within a note: |
| 403 |
:math:`G_{\mu\nu} = 8 \pi G (T_{\mu\nu} + \rho_\Lambda g_{\mu\nu})`. |
| 404 |
|
| 405 |
.. Tip:: 15% if the service is good. |
| 406 |
|
| 407 |
+---------+ |
| 408 |
| Example | |
| 409 |
+=========+ |
| 410 |
| Thing1 | |
| 411 |
+---------+ |
| 412 |
| Thing2 | |
| 413 |
+---------+ |
| 414 |
| Thing3 | |
| 415 |
+---------+ |
| 416 |
|
| 417 |
.. WARNING:: Strong prose may provoke extreme mental exertion. |
| 418 |
Reader discretion is strongly advised. |
| 419 |
|
| 420 |
.. admonition:: And, by the way... |
| 421 |
|
| 422 |
You can make up your own admonition too. |
| 423 |
|
| 424 |
Topics, Sidebars, and Rubrics |
| 425 |
----------------------------- |
| 426 |
|
| 427 |
.. sidebar:: Sidebar Title |
| 428 |
:subtitle: Optional Subtitle |
| 429 |
|
| 430 |
This is a sidebar. It is for text outside the flow of the main |
| 431 |
text. |
| 432 |
|
| 433 |
.. rubric:: This is a rubric inside a sidebar |
| 434 |
|
| 435 |
Sidebars often appears beside the main text with a border and |
| 436 |
background color. |
| 437 |
|
| 438 |
.. topic:: Topic Title |
| 439 |
|
| 440 |
This is a topic. |
| 441 |
|
| 442 |
.. rubric:: This is a rubric |
| 443 |
|
| 444 |
Target Footnotes |
| 445 |
---------------- |
| 446 |
|
| 447 |
.. target-notes:: |
| 448 |
|
| 449 |
Replacement Text |
| 450 |
---------------- |
| 451 |
|
| 452 |
I recommend you try |Python|_. |
| 453 |
|
| 454 |
.. |Python| replace:: Python, *the* best language around |
| 455 |
|
| 456 |
Compound Paragraph |
| 457 |
------------------ |
| 458 |
|
| 459 |
.. compound:: |
| 460 |
|
| 461 |
This paragraph contains a literal block:: |
| 462 |
|
| 463 |
Connecting... OK |
| 464 |
Transmitting data... OK |
| 465 |
Disconnecting... OK |
| 466 |
|
| 467 |
and thus consists of a simple paragraph, a literal block, and |
| 468 |
another simple paragraph. Nonetheless it is semantically *one* |
| 469 |
paragraph. |
| 470 |
|
| 471 |
This construct is called a *compound paragraph* and can be produced |
| 472 |
with the "compound" directive. |
| 473 |
|
| 474 |
Download Links |
| 475 |
============== |
| 476 |
|
| 477 |
:download:`This long long long long long long long long long long long long long long long download link should be blue, normal weight text with a leading icon, and should wrap white-spaces <static/yi_jing_01_chien.jpg>` |