reStructuredText and Sphinx Reference

Example based gentle reference of the reStructuredText and Sphinx syntax, directives, roles and common issues. It demonstrates almost all the markup making it also good for testing Sphinx themes. Free and open-source.

Sample document

This document demonstrate reStructuredText syntax. Professional books and tech documentation are plain text files written with this easy markup language.

Tip

You can try https://snippets.documatt.com, the online editor with preview useful for learning and testing reStructuredText without installing it.

Inline elements

Paragraphs may contain emphasised, strong emphasised words. Links to external webs like https://documatt.com/blog/ are auto-recognized. Sometimes you need monospaced text. Useful are also superscript or subscript.

Images

https://documatt.com/blog/_static/open-doodles-clumsy.svg

Lists

Unordered lists usually use * as bullet symbol:

  • A bullet list item

  • Second item

  • A sub item

Ordered (enumerated) lists that is auto-numbered starts with #.:

  1. one

  2. two

  3. three

Showing code examples

It’s easy to show code parts with inline literal, or literal block:

some literal text

Or, literal block with syntax highlighting:

for (let i = 0; i < 3; i++) {        // shows 0, then 1, then 2
    alert(i);
}