rich-rst Logo

Documentation Contents

  • API Reference
  • Sphinx & RST Demo Gallery
    • Inline Markup
      • Emphasis (italic)
      • Strong (bold)
      • Inline literal (code)
      • Hyperlink (external)
      • Anonymous hyperlink
      • Title reference
      • Subscript role
      • Superscript role
      • Abbreviation role
      • Keyboard role
      • GUI label role
      • Menu selection role
      • File role
      • Sample (samp) role
      • Command role
      • Program role
      • All inline styles combined
      • Inline markup in a list
      • PEP reference role
      • RFC reference role
      • Definition (dfn) role
      • CVE reference role
      • CWE reference role
      • PyPI project reference role
      • Math role (inline)
    • Paragraphs and Sections
      • Plain paragraph
      • Section headings (all 6 levels)
      • Section with overline decoration
      • Document subtitle
      • Multiple paragraphs with transitions
    • Lists
      • Bullet list (dash)
      • Bullet list (asterisk)
      • Nested bullet list
      • Enumerated list (auto-numbered)
      • Bullet list (plus sign)
      • Deeply nested bullet list
      • Enumerated list (uppercase letters)
      • Enumerated list (uppercase roman numerals)
      • Mixed ordered and unordered lists
      • Enumerated list (letters)
      • Enumerated list (roman numerals)
      • Definition list
      • Definition list with classifier
      • Field list
      • Option list
      • Horizontal list (hlist)
    • Block Markup
      • Block quote
      • Line block
      • Doctest block
      • Literal block (indented)
      • Compound directive
      • Parsed literal block
      • Epigraph directive
      • Highlights directive
      • Pull-quote directive
    • Code Blocks
      • code-block with language
      • code-block with line numbers
      • code-block with lineno-start
      • code-block with emphasize-lines
      • code-block with name
      • code-block with dedent
      • sourcecode alias
      • code alias (no language)
      • code-block with caption
      • productionlist directive
    • Admonitions
      • Admonitions Showcase
    • Tables
      • Simple table with header
      • Grid table with row spanning
      • Wider grid table
      • list-table directive
      • CSV Table
      • Flat Table: Basic with Stub Column
      • Flat Table: Column Span (:cspan:)
      • flat-table — wide partial column span (:cspan: > 1)
      • flat-table — row span (:rspan:)
      • Flat Table: Combined :cspan: and :rspan:
      • flat-table — single cell with :cspan: and :rspan: (2×2 block)
      • flat-table — :cspan: fills merged column width without inflation
    • Footnotes and Citations
      • Manual footnote
      • Auto-numbered footnote
      • Named auto footnote
      • Symbol footnote
      • Citation
    • Hyperlinks and Targets
      • Standalone hyperlink
      • External hyperlink (named)
      • Internal cross-reference (indirect target)
      • Anonymous hyperlink
    • Substitutions
      • Text substitution
      • Date substitution
      • Unicode substitution
      • Image substitution
    • Images and Figures
      • image directive
      • figure directive
      • figure with legend
    • Document Structure Directives
      • topic directive
      • sidebar directive
      • rubric directive
      • contents directive (table of contents)
      • sectnum directive
      • header directive
      • footer directive
      • centered directive
    • Math
      • Inline math role
      • math directive (display)
      • math directive (labeled)
    • Document Info (docinfo)
      • Standard docinfo fields
      • Authors list
    • Comments
      • RST comment (invisible)
    • Raw Directive
      • raw html directive
      • raw latex directive
    • Sphinx Version Directives
      • Sphinx Version Directives Showcase
    • Sphinx Cross-Reference Roles
      • Sphinx Cross-Reference Roles Showcase
    • Python Domain Showcase
      • Python domain showcase
    • C Domain Showcase
      • C domain showcase
    • C++ Domain Showcase
      • C++ domain showcase
    • JavaScript Domain Showcase
      • JavaScript domain showcase
    • See Also
      • seealso directive
    • Toctree (Sphinx)
      • toctree directive
      • toctree with numbered entries
    • Glossary
      • glossary directive
      • glossary (sorted)
    • Mixed Sphinx Roles in Prose
      • Mixed roles in a paragraph
  • Styling
  • Extension API
  • Include Directive
  • Limitations and Behavior Notes
  • Index
rich-rst
  • Sphinx & RST Demo Gallery
  • Edit on GitHub

Sphinx & RST Demo Gallery

This page shows every supported RST and Sphinx element rendered by rich-rst. For each element the raw RST source is shown in a code block, followed by the terminal-styled HTML snapshot produced by rich-rst (Dracula theme, 76-column width).

On this page

  • Inline Markup

    • Emphasis (italic)

    • Strong (bold)

    • Inline literal (code)

    • Hyperlink (external)

    • Anonymous hyperlink

    • Title reference

    • Subscript role

    • Superscript role

    • Abbreviation role

    • Keyboard role

    • GUI label role

    • Menu selection role

    • File role

    • Sample (samp) role

    • Command role

    • Program role

    • All inline styles combined

    • Inline markup in a list

    • PEP reference role

    • RFC reference role

    • Definition (dfn) role

    • CVE reference role

    • CWE reference role

    • PyPI project reference role

    • Math role (inline)

  • Paragraphs and Sections

    • Plain paragraph

    • Section headings (all 6 levels)

    • Section with overline decoration

    • Document subtitle

    • Multiple paragraphs with transitions

  • Lists

    • Bullet list (dash)

    • Bullet list (asterisk)

    • Nested bullet list

    • Enumerated list (auto-numbered)

    • Bullet list (plus sign)

    • Deeply nested bullet list

    • Enumerated list (uppercase letters)

    • Enumerated list (uppercase roman numerals)

    • Mixed ordered and unordered lists

    • Enumerated list (letters)

    • Enumerated list (roman numerals)

    • Definition list

    • Definition list with classifier

    • Field list

    • Option list

    • Horizontal list (hlist)

  • Block Markup

    • Block quote

    • Line block

    • Doctest block

    • Literal block (indented)

    • Compound directive

    • Parsed literal block

    • Epigraph directive

    • Highlights directive

    • Pull-quote directive

  • Code Blocks

    • code-block with language

    • code-block with line numbers

    • code-block with lineno-start

    • code-block with emphasize-lines

    • code-block with name

    • code-block with dedent

    • sourcecode alias

    • code alias (no language)

    • code-block with caption

    • productionlist directive

  • Admonitions

    • Admonitions Showcase

  • Tables

    • Simple table with header

    • Grid table with row spanning

    • Wider grid table

    • list-table directive

    • CSV Table

    • Flat Table: Basic with Stub Column

    • Flat Table: Column Span (:cspan:)

    • flat-table — wide partial column span (:cspan: > 1)

    • flat-table — row span (:rspan:)

    • Flat Table: Combined :cspan: and :rspan:

    • flat-table — single cell with :cspan: and :rspan: (2×2 block)

    • flat-table — :cspan: fills merged column width without inflation

  • Footnotes and Citations

    • Manual footnote

    • Auto-numbered footnote

    • Named auto footnote

    • Symbol footnote

    • Citation

  • Hyperlinks and Targets

    • Standalone hyperlink

    • External hyperlink (named)

    • Internal cross-reference (indirect target)

    • Anonymous hyperlink

  • Substitutions

    • Text substitution

    • Date substitution

    • Unicode substitution

    • Image substitution

  • Images and Figures

    • image directive

    • figure directive

    • figure with legend

  • Document Structure Directives

    • topic directive

    • sidebar directive

    • rubric directive

    • contents directive (table of contents)

    • sectnum directive

    • header directive

    • footer directive

    • centered directive

  • Math

    • Inline math role

    • math directive (display)

    • math directive (labeled)

  • Document Info (docinfo)

    • Standard docinfo fields

    • Authors list

  • Comments

    • RST comment (invisible)

  • Raw Directive

    • raw html directive

    • raw latex directive

  • Sphinx Version Directives

    • Sphinx Version Directives Showcase

  • Sphinx Cross-Reference Roles

    • Sphinx Cross-Reference Roles Showcase

  • Python Domain Showcase

    • Python domain showcase

  • C Domain Showcase

    • C domain showcase

  • C++ Domain Showcase

    • C++ domain showcase

  • JavaScript Domain Showcase

    • JavaScript domain showcase

  • See Also

    • seealso directive

  • Toctree (Sphinx)

    • toctree directive

    • toctree with numbered entries

  • Glossary

    • glossary directive

    • glossary (sorted)

  • Mixed Sphinx Roles in Prose

    • Mixed roles in a paragraph

Inline Markup

Emphasis (italic)

*italicised text*
italicised text

Strong (bold)

**bold text**
bold text

Inline literal (code)

Use ``print()`` to display output.
Use print() to display output.

Hyperlink (external)

Visit `Python <https://www.python.org>`_ for more.
Visit Python for more.

Anonymous hyperlink

See `Rich docs <https://rich.readthedocs.io>`__ for styling.
See Rich docs for styling.

Title reference

Read `The Zen of Python` for inspiration.
Read The Zen of Python for inspiration.

Subscript role

H\ :sub:`2`\ O is water.
H₂O is water.

Superscript role

E = mc\ :sup:`2`
E = mc²

Abbreviation role

:abbr:`RST (reStructuredText)` is a markup language.
RST (reStructuredText) is a markup language.

Keyboard role

Press :kbd:`Ctrl+C` to copy.
Press Ctrl+C to copy.

GUI label role

Click :guilabel:`OK` to confirm.
Click OK to confirm.

Menu selection role

Go to :menuselection:`File --> Save As`.
Go to File ▶ Save As.

File role

Edit :file:`/etc/hosts` with sudo.
Edit /etc/hosts with sudo.

Sample (samp) role

Type :samp:`ping {host}` in the terminal.
Type ping host in the terminal.

Command role

Run :command:`python -m pytest`.
Run python -m pytest.

Program role

:program:`git` is a distributed version control system.
git is a distributed version control system.

All inline styles combined

*Italic*, **bold**, ``literal``, :kbd:`Ctrl+C`,
:guilabel:`OK`, :menuselection:`File --> Open`,
:file:`~/.bashrc`, :command:`ls -la`,
and :sup:`superscript`.
Italic, bold, literal, Ctrl+C, OK, File ▶ Open, ~/.bashrc, ls -la, and 
ˢᵘᵖᵉʳˢᶜʳⁱᵖᵗ.

Inline markup in a list

- Use **bold** for important terms
- Use *italic* for emphasis
- Use ``code`` for inline code samples
- Use :kbd:`Enter` for key presses
 • Use bold for important terms
 • Use italic for emphasis
 • Use code for inline code samples
 • Use Enter for key presses

PEP reference role

See :pep:`8` for Python style guidelines.
See PEP 8 for Python style guidelines.

RFC reference role

HTTP is described in :rfc:`2616`.
HTTP is described in RFC 2616.

Definition (dfn) role

A :dfn:`docstring` is a string literal that documents a Python object.
A docstring is a string literal that documents a Python object.

CVE reference role

This vulnerability is tracked as :cve:`2024-3094`.
This vulnerability is tracked as CVE-2024-3094.

CWE reference role

This bug is categorized under :cwe:`79`.
This bug is categorized under CWE-79.

PyPI project reference role

Install the package from :pypi:`requests`.
Install the package from requests.

Math role (inline)

The area of a circle is :math:`\pi r^2`.
The area of a circle is π r^2.

Paragraphs and Sections

Plain paragraph

This is a plain paragraph.  Paragraphs are separated
by blank lines.

A second paragraph follows here.
This is a plain paragraph.  Paragraphs are separated by blank lines.

A second paragraph follows here.

Section headings (all 6 levels)

Level 1 Title
=============
Some body text under level 1.

Level 2 Title
-------------
Some body text under level 2.

Level 3 Title
~~~~~~~~~~~~~
Some body text under level 3.

Level 4 Title
^^^^^^^^^^^^^
Some body text under level 4.

Level 5 Title
"""""""""""""
Some body text under level 5.

Level 6 Title
'''''''''''''
Some body text under level 6.
╔══════════════════════════════════════════════════════════════════════════╗
║                              Level 1 Title                               ║
╚══════════════════════════════════════════════════════════════════════════╝
Some body text under level 1.

╭──────────────────────────────────────────────────────────────────────────╮
│                              Level 2 Title                               │
╰──────────────────────────────────────────────────────────────────────────╯
Some body text under level 2.

                               Level 3 Title

Some body text under level 3.

                               Level 4 Title

Some body text under level 4.

                               Level 5 Title

Some body text under level 5.

                               Level 6 Title

Some body text under level 6.

Section with overline decoration

##################
Part-level heading
##################

Body text below the overlined heading.
╔══════════════════════════════════════════════════════════════════════════╗
║                            Part-level heading                            ║
╚══════════════════════════════════════════════════════════════════════════╝
Body text below the overlined heading.

Document subtitle

My Document
===========

A subtitle here
---------------

Body text.
╔══════════════════════════════════════════════════════════════════════════╗
║                               My Document                                ║
╚══════════════════════════════════════════════════════════════════════════╝
╭──────────────────────────────────────────────────────────────────────────╮
│                             A subtitle here                              │
╰──────────────────────────────────────────────────────────────────────────╯

Body text.

Multiple paragraphs with transitions

First paragraph before the transition.

----

Second paragraph after the first transition.

----

Third paragraph after the second transition.
First paragraph before the transition.

────────────────────────────────────────────────────────────────────────────
Second paragraph after the first transition.

────────────────────────────────────────────────────────────────────────────
Third paragraph after the second transition.

Lists

Bullet list (dash)

- First item
- Second item
- Third item
 • First item
 • Second item
 • Third item

Bullet list (asterisk)

* Alpha
* Beta
* Gamma
 • Alpha
 • Beta
 • Gamma

Nested bullet list

- Parent item

  - Child item one
  - Child item two

- Another parent
 • Parent item
   ∘ Child item one
   ∘ Child item two
 • Another parent

Enumerated list (auto-numbered)

#. First step
#. Second step
#. Third step
 1. First step
 2. Second step
 3. Third step

Bullet list (plus sign)

+ One
+ Two
+ Three
 • One
 • Two
 • Three

Deeply nested bullet list

- Level 1 item A

  - Level 2 item A1

    - Level 3 item A1a
    - Level 3 item A1b

  - Level 2 item A2

- Level 1 item B
 • Level 1 item A
   ∘ Level 2 item A1
     ▪ Level 3 item A1a
     ▪ Level 3 item A1b
   ∘ Level 2 item A2
 • Level 1 item B

Enumerated list (uppercase letters)

A. Alpha
B. Beta
C. Gamma
 A. Alpha
 B. Beta
 C. Gamma

Enumerated list (uppercase roman numerals)

I.  Chapter One
II.  Chapter Two
III. Chapter Three
 I. Chapter One
 II. Chapter Two
 III. Chapter Three

Mixed ordered and unordered lists

Steps to install:

1. Download the package

   - Linux: ``apt install ...``
   - macOS: ``brew install ...``

2. Run the installer
3. Verify with ``--version``
Steps to install:

 1. Download the package
   ∘ Linux: apt install ...
   ∘ macOS: brew install ...
 2. Run the installer
 3. Verify with --version

Enumerated list (letters)

a. Apple
b. Banana
c. Cherry
 a. Apple
 b. Banana
 c. Cherry

Enumerated list (roman numerals)

i. Item i
ii. Item ii
iii. Item iii
 i. Item i
 ii. Item ii
 iii. Item iii

Definition list

term
    Definition of the term.

another term
    Its definition spans
    multiple lines.
term
    Definition of the term.

another term
    Its definition spans multiple lines.

Definition list with classifier

term : string
    A string-typed term.

count : int
    An integer count.
term : string
    A string-typed term.


count : int
    An integer count.

Field list

:Name: John Doe
:Email: john@example.com
:Role: Developer
      Document Information       
┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
┃ Field Name ┃ Field Value      ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
│ Name       │ John Doe         │
├────────────┼──────────────────┤
│ Email      │ john@example.com │
├────────────┼──────────────────┤
│ Role       │ Developer        │
└────────────┴──────────────────┘

Option list

-v, --verbose    Enable verbose output.
-o FILE          Write output to FILE.
--help           Show this help message.
-v, --verbose,
    Enable verbose output.
-o FILE
    Write output to FILE.
--help
    Show this help message.

Horizontal list (hlist)

.. hlist::
   :columns: 3

   * Alpha
   * Beta
   * Gamma
   * Delta
   * Epsilon
   * Zeta
   * Eta
   * Theta
   * Iota
 Alpha  Beta     Gamma
                      
 Delta  Epsilon  Zeta 
                      
 Eta    Theta    Iota 
                      

Block Markup

Block quote

Normal paragraph.

    This is an indented block quote.

    -- Attribution
Normal paragraph.

▌ This is an indented block quote.

  — Attribution

Line block

| The first line of a poem.
| The second line continues.
|   An indented third line.
The first line of a poem.
The second line continues.
    An indented third line.

Doctest block

>>> print("Hello, world!")
Hello, world!
>>> 1 + 1
2
┌───────────────────────────── doctest block ──────────────────────────────┐
│ >>> print("Hello, world!")                                               │
│ Hello, world!                                                            │
│ >>> 1 + 1                                                                │
│ 2                                                                        │
└──────────────────────────────────────────────────────────────────────────┘

Literal block (indented)

Example code::

    def greet(name):
        print(f"Hello, {name}!")
Example code:
┌───────────────────────────── text (default) ─────────────────────────────┐
│ def greet(name):                                                         │
│     print(f"Hello, {name}!")                                             │
└──────────────────────────────────────────────────────────────────────────┘

Compound directive

.. compound::
   :class: custom-compound-class

   The first sentence of a paragraph.

   The second paragraph of the compound block,
   rendered as a single logical paragraph.
The first sentence of a paragraph.

The second paragraph of the compound block, rendered as a single logical 
paragraph.

Parsed literal block

.. parsed-literal::
   :class: custom-parsed-literal-class
   :name: custom-parsed-literal-name

   **Bold** and *italic* inside a literal block.
   Also ``code`` here.
┌────────────── parsed-literal — custom-parsed-literal-name ───────────────┐
│ Bold and italic inside a literal block.                                  │
│ Also code here.                                                          │
└──────────────────────────────────────────────────────────────────────────┘

Epigraph directive

.. epigraph::
   :class: custom-epigraph-class

   No man is an island,
   entire of itself.

   -- John Donne
▌ No man is an island, entire of itself.

  — John Donne

Highlights directive

.. highlights::
   :class: custom-highlights-class

   Key takeaways:

   - Keep it simple.
   - Document everything.
▌ Key takeaways:
▌
▌  • Keep it simple.
▌  • Document everything.

Pull-quote directive

.. pull-quote::
   :class: custom-pull-quote-class

   The best way to predict the future
   is to invent it.

   -- Alan Kay
▌ The best way to predict the future is to invent it.

  — Alan Kay

Code Blocks

code-block with language

.. code-block:: python

   def factorial(n):
       if n == 0:
           return 1
       return n * factorial(n - 1)
┌───────────────────────────────── python ─────────────────────────────────┐
│ def factorial(n):                                                        │
│     if n == 0:                                                           │
│         return 1                                                         │
│     return n * factorial(n - 1)                                          │
└──────────────────────────────────────────────────────────────────────────┘

code-block with line numbers

.. code-block:: python
   :linenos:

   x = 1
   y = 2
   print(x + y)
┌───────────────────────────────── python ─────────────────────────────────┐
│   1 x = 1                                                                │
│   2 y = 2                                                                │
│   3 print(x + y)                                                         │
└──────────────────────────────────────────────────────────────────────────┘

code-block with lineno-start

.. code-block:: python
   :linenos:
   :lineno-start: 10

   x = 1
   y = 2
┌───────────────────────────────── python ─────────────────────────────────┐
│   10 x = 1                                                               │
│   11 y = 2                                                               │
└──────────────────────────────────────────────────────────────────────────┘

code-block with emphasize-lines

.. code-block:: python
   :emphasize-lines: 3,5

   def some_function():
       interesting = False
       print('This line is highlighted.')
       print('This one is not...')
       print('...but this one is.')
┌───────────────────────────────── python ─────────────────────────────────┐
│   1 def some_function():                                                 │
│   2     interesting = False                                              │
│ ❱ 3     print('This line is highlighted.')                               │
│   4     print('This one is not...')                                      │
│ ❱ 5     print('...but this one is.')                                     │
└──────────────────────────────────────────────────────────────────────────┘

code-block with name

.. code-block:: python
   :name: example-id

   x = 1
   y = 2
┌────────────────────────── python — example-id ───────────────────────────┐
│ x = 1                                                                    │
│ y = 2                                                                    │
└──────────────────────────────────────────────────────────────────────────┘

code-block with dedent

.. code-block:: python
   :dedent:

       def foo():
           return 1
┌───────────────────────────────── python ─────────────────────────────────┐
│ def foo():                                                               │
│     return 1                                                             │
└──────────────────────────────────────────────────────────────────────────┘

sourcecode alias

.. sourcecode:: javascript
   :class: custom-sourcecode-class
   :name: custom-sourcecode-id
   :linenos:
   :lineno-start: 5

   const greet = (name) => `Hello, ${name}!`;
   console.log(greet('World'));
┌─────────────────── javascript — custom-sourcecode-id ────────────────────┐
│   5 const greet = (name) => `Hello, ${name}!`;                           │
│   6 console.log(greet('World'));                                         │
└──────────────────────────────────────────────────────────────────────────┘

code alias (no language)

.. code::
   :class: custom-code-class
   :name: custom-code-id

   plain text block
   no syntax highlighting
┌──────────────────── text (default) — custom-code-id ─────────────────────┐
│ plain text block                                                         │
│ no syntax highlighting                                                   │
└──────────────────────────────────────────────────────────────────────────┘

code-block with caption

.. code-block:: python
   :linenos:
   :lineno-start: 10
   :emphasize-lines: 3
   :caption: math_utils.py
   :name: math-utils-code
   :dedent: 4
   :force:
   :class: python-utility-class

       def add(a, b):
           # This line is emphasised
           return a + b
┌──────────────────────── python — math-utils-code ────────────────────────┐
│   10 def add(a, b):                                                      │
│   11     # This line is emphasised                                       │
│   12     return a + b                                                    │
└──────────────────────────────────────────────────────────────────────────┘

productionlist directive

.. productionlist:: grammar

   statement  : expression NEWLINE
   expression : term ('+' term)*
   term       : factor ('*' factor)*
┌───────────────────────────── productionlist ─────────────────────────────┐
│ statement  : expression NEWLINE                                          │
│ expression : term ('+' term)*                                            │
│ term       : factor ('*' factor)*                                        │
└──────────────────────────────────────────────────────────────────────────┘

Admonitions

Admonitions Showcase

.. note::
   Call ``sys.exit(0)`` to terminate *successfully*,
   or ``sys.exit(1)`` for **failure**.

   Notes can contain **bold**, *italic*, and ``code``.
   They can also contain lists:

   - item one
   - item two

.. warning::
   **Never** commit secrets to version control.
   Use environment variables or a secrets manager instead.

.. tip::
   This is a tip.

.. important::
   This is important.

.. hint::
   This is a hint.

.. attention::
   Pay attention to this.

.. caution::
   Exercise caution here.

.. danger::
   Danger! Proceed carefully.

.. error::
   An error occurred.

.. admonition:: Did you know?
   :class: custom-admonition-class
   :name: custom-admonition-id

   rich-rst supports all currently documented RST elements.
╭────────────────────────────────── Note ──────────────────────────────────╮
│ Call sys.exit(0) to terminate successfully, or sys.exit(1) for failure.  │
│                                                                          │
│ Notes can contain bold, italic, and code. They can also contain lists:   │
│                                                                          │
│  • item one                                                              │
│  • item two                                                              │
╰──────────────────────────────────────────────────────────────────────────╯
╭──────────────────────────────── Warning ─────────────────────────────────╮
│ Never commit secrets to version control. Use environment variables or a  │
│ secrets manager instead.                                                 │
╰──────────────────────────────────────────────────────────────────────────╯
╭────────────────────────────────── Tip ───────────────────────────────────╮
│ This is a tip.                                                           │
╰──────────────────────────────────────────────────────────────────────────╯
╭─────────────────────────────── IMPORTANT ────────────────────────────────╮
│ This is important.                                                       │
╰──────────────────────────────────────────────────────────────────────────╯
╭────────────────────────────────── Hint ──────────────────────────────────╮
│ This is a hint.                                                          │
╰──────────────────────────────────────────────────────────────────────────╯
╭─────────────────────────────── Attention ────────────────────────────────╮
│ Pay attention to this.                                                   │
╰──────────────────────────────────────────────────────────────────────────╯
╭──────────────────────────────── Caution ─────────────────────────────────╮
│ Exercise caution here.                                                   │
╰──────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────── DANGER ─────────────────────────────────╮
│ Danger! Proceed carefully.                                               │
╰──────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────── ERROR ──────────────────────────────────╮
│ An error occurred.                                                       │
╰──────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────── Did you know? ──────────────────────────────╮
│ rich-rst supports all currently documented RST elements.                 │
╰──────────────────────────────────────────────────────────────────────────╯

Tables

Simple table with header

=====  =====  ======
Col A  Col B  Col C
=====  =====  ======
1      2      3
4      5      6
=====  =====  ======
┏━━━━━━━┳━━━━━━━┳━━━━━━━┓
┃ Col A ┃ Col B ┃ Col C ┃
┡━━━━━━━╇━━━━━━━╇━━━━━━━┩
│ 1     │ 2     │ 3     │
├───────┼───────┼───────┤
│ 4     │ 5     │ 6     │
└───────┴───────┴───────┘

Grid table with row spanning

+------------+------------+
| Column 1   | Column 2   |
+============+============+
| Rows 1 & 2 | Row 1      |
+            +------------+
|            | Row 2      |
+------------+------------+
┏━━━━━━━━━━━━┳━━━━━━━━━━┓
┃ Column 1   ┃ Column 2 ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━┩
│ Rows 1 & 2 │ Row 1    │
│            ├──────────┤
│            │ Row 2    │
└────────────┴──────────┘

Wider grid table

+--------+-------+------+---------+
| Name   | Type  | Size | Default |
+========+=======+======+=========+
| width  | int   | 4    | 80      |
+--------+-------+------+---------+
| height | int   | 4    | 24      |
+--------+-------+------+---------+
| title  | str   | var  | ''      |
+--------+-------+------+---------+
┏━━━━━━━━┳━━━━━━┳━━━━━━┳━━━━━━━━━┓
┃ Name   ┃ Type ┃ Size ┃ Default ┃
┡━━━━━━━━╇━━━━━━╇━━━━━━╇━━━━━━━━━┩
│ width  │ int  │ 4    │ 80      │
├────────┼──────┼──────┼─────────┤
│ height │ int  │ 4    │ 24      │
├────────┼──────┼──────┼─────────┤
│ title  │ str  │ var  │ ''      │
└────────┴──────┴──────┴─────────┘

list-table directive

.. list-table:: Comparison
   :header-rows: 1
   :stub-columns: 1
   :widths: 30 35 35
   :align: center
   :class: custom-list-table-class
   :name: custom-list-table-name

   * - Library
     - Language
     - Stars
   * - rich
     - Python
     - 50k+
   * - rich-rst
     - Python
     - 1k+
          Comparison           
┏━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━┓
┃ Library  ┃ Language ┃ Stars ┃
┡━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━┩
│ rich     │ Python   │ 50k+  │
├──────────┼──────────┼───────┤
│ rich-rst │ Python   │ 1k+   │
└──────────┴──────────┴───────┘

CSV Table

.. csv-table:: Data
   :header: "Name", "Value", "Unit"
   :widths: 20, 20, 20
   :delim: ,
   :quote: "
   :keepspace:
   :escape: \
   :class: custom-csv-table-class
   :name: custom-csv-table-name
   :align: center

   "Speed", "299 792 458", "m/s"
   "Charge", "1.602e-19", "C"
   "Mass", "9.109e-31", "kg"
                                    Data                                    
┏━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Name   ┃ "Value"                        ┃ "Unit"                         ┃
┡━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ Speed  │ ▌ "299 792 458"                │ ▌ "m/s"                        │
│        │                                │                                │
├────────┼────────────────────────────────┼────────────────────────────────┤
│ Charge │ ▌ "1.602e-19"                  │ ▌ "C"                          │
│        │                                │                                │
├────────┼────────────────────────────────┼────────────────────────────────┤
│ Mass   │ ▌ "9.109e-31"                  │ ▌ "kg"                         │
│        │                                │                                │
└────────┴────────────────────────────────┴────────────────────────────────┘

Flat Table: Basic with Stub Column

.. flat-table:: Linux Kernel Subsystems
   :header-rows: 1
   :stub-columns: 1
   :widths: 20 30 50
   :fill-cells:
   :class: custom-flat-table-class
   :name: custom-flat-table-name

   * - Subsystem
     - Maintainer
     - Description

   * - Networking
     - David S. Miller
     - TCP/IP stack and network drivers

   * - Memory Management
     - Andrew Morton
     - Virtual memory, paging, and allocators

   * - File Systems
     - Linus Torvalds
     - VFS layer and filesystem drivers
                          Linux Kernel Subsystems                           
┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Subsystem         ┃ Maintainer      ┃ Description                        ┃
┡━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ Networking        │ David S. Miller │ TCP/IP stack and network drivers   │
├───────────────────┼─────────────────┼────────────────────────────────────┤
│ Memory Management │ Andrew Morton   │ Virtual memory, paging, and        │
│                   │                 │ allocators                         │
├───────────────────┼─────────────────┼────────────────────────────────────┤
│ File Systems      │ Linus Torvalds  │ VFS layer and filesystem drivers   │
└───────────────────┴─────────────────┴────────────────────────────────────┘

Flat Table: Column Span (:cspan:)

.. flat-table:: Quarterly Results
   :header-rows: 1

   * - Student
     - Q1
     - Q2
     - Q3

   * - :cspan:`3` Grand total — all students, all quarters

   * - Alice
     - 90
     - 85
     - 92

   * - Bob
     - 80
     - 88
     - 76
             Quarterly Results              
┏━━━━━━━━━┳━━━━┳━━━━┳━━━━━━━━━━━━━━━━━━━━━━┓
┃ Student ┃ Q1 ┃ Q2 ┃ Q3                   ┃
┡━━━━━━━━━┻━━━━┻━━━━┻━━━━━━━━━━━━━━━━━━━━━━┩
│ Grand total — all students, all quarters │
├─────────┬────┬────┬──────────────────────┤
│ Alice   │ 90 │ 85 │ 92                   │
├─────────┼────┼────┼──────────────────────┤
│ Bob     │ 80 │ 88 │ 76                   │
└─────────┴────┴────┴──────────────────────┘

flat-table — wide partial column span (:cspan: > 1)

.. flat-table:: Regional Sales
   :header-rows: 1

   * - Region
     - Q1
     - Q2
     - Q3

   * - :cspan:`2` North + Central + South combined
     - 312

   * - North
     - 42
     - 55
     - 61

   * - Central
     - 78
     - 90
     - 83

   * - South
     - 34
     - 48
     - 55
              Regional Sales              
┏━━━━━━━━━┳━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━┓
┃ Region  ┃ Q1 ┃ Q2                ┃ Q3  ┃
┡━━━━━━━━━┻━━━━┻━━━━━━━━━━━━━━━━━━━╇━━━━━┩
│ North + Central + South combined │ 312 │
├─────────┬────┬───────────────────┼─────┤
│ North   │ 42 │ 55                │ 61  │
├─────────┼────┼───────────────────┼─────┤
│ Central │ 78 │ 90                │ 83  │
├─────────┼────┼───────────────────┼─────┤
│ South   │ 34 │ 48                │ 55  │
└─────────┴────┴───────────────────┴─────┘

flat-table — row span (:rspan:)

.. flat-table:: Produce Prices
   :header-rows: 1

   * - Category
     - Item
     - Price

   * - :rspan:`1` Fruit
     - Apple
     - $1.00

   * - Banana
     - $0.50

   * - :rspan:`1` Vegetable
     - Carrot
     - $0.75

   * - Broccoli
     - $1.25
         Produce Prices         
┏━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━┓
┃ Category  ┃ Item     ┃ Price ┃
┡━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━┩
│ Fruit     │ Apple    │ $1.00 │
│           ├──────────┼───────┤
│           │ Banana   │ $0.50 │
├───────────┼──────────┼───────┤
│ Vegetable │ Carrot   │ $0.75 │
│           ├──────────┼───────┤
│           │ Broccoli │ $1.25 │
└───────────┴──────────┴───────┘

Flat Table: Combined :cspan: and :rspan:

.. flat-table:: Combined Spans
   :header-rows: 3

   * - Full-width title header

   * - :cspan:`1` header 1
     - :cspan:`1` header 2
     - :cspan:`1` header 3

   * - Sub-header 1
     - Sub-header 2
     - Sub-header 3
     - Sub-header 4
     - Sub-header 5
     - Sub-header 6

   * - :rspan:`1` :cspan:`1` Big cell spanning 2 rows and 2 column
     - :cspan:`1` Large cell spanning 2 columns
     - :cspan:`3` Large cell spanning 4 columns

   * - :rspan:`1` Tall cell spanning 2 rows
     - Cell 3
     - :rspan:`1` :cspan:`2` Big cell spanning 2 rows and 3 columns

   * - Cell 1
     - Cell 2
     - Cell 4
     -
                               Combined Spans                               
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Full-width title header                                                  ┃
┣━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ header 1              ┃ header 2                ┃ header 3               ┃
┣━━━━━━━━━━━┳━━━━━━━━━━━╋━━━━━━━━━━━━┳━━━━━━━━━━━━╋━━━━━━━━━━━━┳━━━━━━━━━━━┫
┃ Sub-heade ┃ Sub-heade ┃ Sub-header ┃ Sub-header ┃ Sub-header ┃ Sub-heade ┃
┃ r 1       ┃ r 2       ┃ 3          ┃ 4          ┃ 5          ┃ r 6       ┃
┡━━━━━━━━━━━┻━━━━━━━━━━━╇━━━━━━━━━━━━┻━━━━━━━━━━━━╇━━━━━━━━━━━━┻━━━━━━━━━━━┩
│ Big cell spanning 2   │ Large cell spanning 2   │ Large cell spanning 4  │
│ rows and 2 column     │ columns                 │ columns                │
│                       ├────────────┬────────────┼────────────────────────┤
│                       │ Tall cell  │ Cell 3     │ Big cell spanning 2    │
│                       │ spanning 2 │            │ rows and 3 columns     │
│                       │ rows       │            │                        │
├───────────┬───────────┤            ├────────────┤                        │
│ Cell 1    │ Cell 2    │            │ Cell 4     │                        │
└───────────┴───────────┴────────────┴────────────┴────────────────────────┘

flat-table — single cell with :cspan: and :rspan: (2×2 block)

.. flat-table:: 2×2 merged cell
   :header-rows: 1

   * - Task
     - Mon
     - Tue
     - Wed
     - Thu
     - Fri

   * - :cspan:`2` :rspan:`1` Planning
     - Review

   * - Deploy

   * - Others.
           2×2 merged cell            
┏━━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━┓
┃ Task ┃ Mon ┃ Tue ┃ Wed ┃ Thu ┃ Fri ┃
┡━━━━━━┻━━━━━┻━━━━━╇━━━━━┻━━━━━┻━━━━━┩
│ Planning         │ Review          │
│                  ├─────────────────┤
│                  │ Deploy          │
├──────────────────┴─────────────────┤
│ Others.                            │
└────────────────────────────────────┘

flat-table — :cspan: fills merged column width without inflation

.. flat-table:: Team Overview
   :header-rows: 1

   * - Name
     - Role

   * - :cspan:`1` Both columns

   * - Alice
     - Lead

   * - Bob
     - Dev
 Team Overview  
┏━━━━━━━┳━━━━━━┓
┃ Name  ┃ Role ┃
┡━━━━━━━┻━━━━━━┩
│ Both columns │
├───────┬──────┤
│ Alice │ Lead │
├───────┼──────┤
│ Bob   │ Dev  │
└───────┴──────┘

Footnotes and Citations

Manual footnote

See the footnote [1]_ for details.

.. [1] This is the footnote text.
See the footnote [1] for details.
┌───────────────────────────────── Footer ─────────────────────────────────┐
│ 1: This is the footnote text.                                            │
└──────────────────────────────────────────────────────────────────────────┘

Auto-numbered footnote

First reference [#]_.
Second reference [#]_.

.. [#] First auto footnote.
.. [#] Second auto footnote.
First reference [1]. Second reference [2].
┌───────────────────────────────── Footer ─────────────────────────────────┐
│ 1: First auto footnote.                                                  │
│ 2: Second auto footnote.                                                 │
└──────────────────────────────────────────────────────────────────────────┘

Named auto footnote

See [#note]_ for details.

.. [#note] The named auto footnote.
See [1] for details.
┌───────────────────────────────── Footer ─────────────────────────────────┐
│ 1: The named auto footnote.                                              │
└──────────────────────────────────────────────────────────────────────────┘

Symbol footnote

Marked with a symbol [*]_.

.. [*] Symbol footnote text.
Marked with a symbol [*].
┌───────────────────────────────── Footer ─────────────────────────────────┐
│ *: Symbol footnote text.                                                 │
└──────────────────────────────────────────────────────────────────────────┘

Citation

As described in [Doe2023]_.

.. [Doe2023] John Doe. *Python Patterns*. 2023.
As described in Doe2023.
┌──────────────────────────────── citation ────────────────────────────────┐
│ Doe2023: John Doe. Python Patterns. 2023.                                │
└──────────────────────────────────────────────────────────────────────────┘

Hyperlinks and Targets

Standalone hyperlink

Visit https://python.org for more.
Visit https://python.org for more.

External hyperlink (named)

Read the `Rich documentation`_.

.. _Rich documentation: https://rich.readthedocs.io
Read the Rich documentation.

Internal cross-reference (indirect target)

Jump to `Target Section`_.

Target Section
~~~~~~~~~~~~~~

Content here.
Jump to Target Section.

╭──────────────────────────────────────────────────────────────────────────╮
│                              Target Section                              │
╰──────────────────────────────────────────────────────────────────────────╯
Content here.

Anonymous hyperlink

See `this page <https://example.com>`__ for details.
See this page for details.

Substitutions

Text substitution

|project| is written in Python.

.. |project| replace:: rich-rst
rich-rst is written in Python.

Date substitution

Generated on |today|.

.. |today| date:: %Y-%m-%d
Generated on 2026-07-18.

Unicode substitution

Copyright |copy| 2024 The Authors.

.. |copy| unicode:: U+00A9 .. copyright sign
Copyright © 2024 The Authors.

Image substitution

Click the |logo| icon.

.. |logo| image:: https://example.com/logo.png
   :alt: Logo
Click the 🌆 Logo icon.

Images and Figures

image directive

.. image:: https://example.com/photo.png
   :alt: A photo
   :height: 300px
   :width: 400px
   :scale: 50%
   :align: center
   :target: https://example.com
   :class: custom-image-class
   :name: custom-image-id
🌆 A photo

figure directive

.. figure:: https://example.com/chart.png
   :alt: A chart
   :height: 400px
   :width: 600px
   :scale: 75%
   :align: center
   :target: https://example.com
   :class: custom-figure-class
   :name: custom-figure-id
   :figwidth: 500px
   :figclass: custom-figure-container-class

   Figure caption goes here.
╭─ Figure caption goes here. ─╮
│ 🌆 A chart                  │
╰─────────────────────────────╯

figure with legend

.. figure:: https://example.com/diagram.png
   :alt: Diagram
   :figwidth: image
   :class: custom-figure-legend-class

   Caption text.

   Legend text with more details about the figure.
╭───────────────── Caption text. ─────────────────╮
│ 🌆 Diagram                                      │
│ Legend text with more details about the figure. │
╰─────────────────────────────────────────────────╯

Document Structure Directives

topic directive

.. topic:: Interesting Fact
   :class: custom-topic-class
   :name: custom-topic-id

   This is the topic body.
   It can contain any body elements.
╭──────────────────────────── Interesting Fact ────────────────────────────╮
│ This is the topic body. It can contain any body elements.                │
╰──────────────────────────────────────────────────────────────────────────╯

sidebar directive

.. sidebar:: Note
   :subtitle: Side note
   :class: custom-sidebar-class
   :name: custom-sidebar-id

   Sidebar text goes here.
╭───────── Note ──────────╮
│ Sidebar text goes here. │
╰─────── Side note ───────╯

rubric directive

.. rubric:: An Unnumbered Heading
   :class: custom-rubric-class
   :name: custom-rubric-id

Following paragraph.
╭──────────────────────────────────────────────────────────────────────────╮
│                          An Unnumbered Heading                           │
╰──────────────────────────────────────────────────────────────────────────╯
Following paragraph.

contents directive (table of contents)

.. contents:: Table of Contents
   :depth: 2
   :local:
   :backlinks: entry
   :class: custom-contents-class

Section A
---------

Content A.

Section B
---------

Content B.
╭─────────────────────────── Table of Contents ────────────────────────────╮
│  • Section A                                                             │
│  • Section B                                                             │
╰──────────────────────────────────────────────────────────────────────────╯
╭──────────────────────────────────────────────────────────────────────────╮
│                                Section A                                 │
╰──────────────────────────────────────────────────────────────────────────╯
Content A.

╭──────────────────────────────────────────────────────────────────────────╮
│                                Section B                                 │
╰──────────────────────────────────────────────────────────────────────────╯
Content B.

sectnum directive

.. sectnum::
   :depth: 3
   :start: 1
   :prefix: Section-
   :suffix: .

Overview
--------

Details
-------
╭──────────────────────────────────────────────────────────────────────────╮
│                          Section-1.   Overview                           │
╰──────────────────────────────────────────────────────────────────────────╯
╭──────────────────────────────────────────────────────────────────────────╮
│                           Section-2.   Details                           │
╰──────────────────────────────────────────────────────────────────────────╯

header directive

.. header:: My Document Header

Main content.
╔════════════════════════════════ caption ═════════════════════════════════╗
║                            My Document Header                            ║
╚══════════════════════════════════════════════════════════════════════════╝
Main content.

footer directive

Main content.

.. footer:: Page |page|
Main content.
┌───────────────────────────────── Footer ─────────────────────────────────┐
│                                  Page 1                                  │
└──────────────────────────────────────────────────────────────────────────┘

centered directive

.. centered:: IMPORTANT NOTICE

Body text.
                              IMPORTANT NOTICE
Body text.

Math

Inline math role

The Pythagorean theorem: :math:`a^2 + b^2 = c^2`.
The Pythagorean theorem: a^2 + b^2 = c^2.

math directive (display)

.. math::

   \int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
┌────────────────────────────────── math ──────────────────────────────────┐
│ ∫_-∞^∞ e^-x^2 dx = √(π)                                                  │
└──────────────────────────────────────────────────────────────────────────┘

math directive (labeled)

.. math:: E = mc^2
   :label: einstein
   :nowrap:
   :class: custom-math-class
   :name: custom-math-id
┌──────────────────────────── math - einstein ─────────────────────────────┐
│ E = mc^2                                                                 │
└──────────────────────────────────────────────────────────────────────────┘

Document Info (docinfo)

Standard docinfo fields

My Report
=========

:Author: Jane Smith
:Date: 2024-01-15
:Version: 1.0
:Status: Draft
:Copyright: 2024 Jane Smith
:Organization: ACME Corp

Body of the document.
╔══════════════════════════════════════════════════════════════════════════╗
║                                My Report                                 ║
╚══════════════════════════════════════════════════════════════════════════╝
       Document Information       
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓
┃ Field Name   ┃ Field Value     ┃
┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩
│ Author       │ Jane Smith      │
├──────────────┼─────────────────┤
│ Date         │ 2024-01-15      │
├──────────────┼─────────────────┤
│ Version      │ 1.0             │
├──────────────┼─────────────────┤
│ Status       │ Draft           │
├──────────────┼─────────────────┤
│ Copyright    │ 2024 Jane Smith │
├──────────────┼─────────────────┤
│ Organization │ ACME Corp       │
└──────────────┴─────────────────┘
Body of the document.

Authors list

:Authors: - Alice
          - Bob
          - Carol

Body text.
    Document Information    
┏━━━━━━━━━━━━┳━━━━━━━━━━━━━┓
┃ Field Name ┃ Field Value ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━━━━┩
│ Authors    │ Alice       │
│            │ Bob         │
│            │ Carol       │
└────────────┴─────────────┘
Body text.

Comments

RST comment (invisible)

Before comment.

.. This is an RST comment and should not appear in output.

After comment.
Before comment.

After comment.

Raw Directive

raw html directive

.. raw:: html
   :class: custom-raw-class

   <strong>Bold via raw HTML</strong>
┌─────────────────────────── stripped raw html ────────────────────────────┐
│ Bold via raw HTML                                                        │
└──────────────────────────────────────────────────────────────────────────┘

raw latex directive

.. raw:: latex
   :class: custom-raw-class

   \textbf{Bold via LaTeX}
┌─────────────────────────────── raw latex ────────────────────────────────┐
│ \textbf{Bold via LaTeX}                                                  │
└──────────────────────────────────────────────────────────────────────────┘

Sphinx Version Directives

Sphinx Version Directives Showcase

.. versionadded:: 2.1

   This feature was added in version 2.1.

.. versionchanged:: 3.0

   The API changed in version 3.0.

.. deprecated:: 1.5

   Use the new API instead.

.. deprecated-removed:: 1.5 2.0

   Removed in 2.0. Use the new API.
╭─────────────────────────── New in version 2.1 ───────────────────────────╮
│ This feature was added in version 2.1.                                   │
╰──────────────────────────────────────────────────────────────────────────╯
╭───────────────────────── Changed in version 3.0 ─────────────────────────╮
│ The API changed in version 3.0.                                          │
╰──────────────────────────────────────────────────────────────────────────╯
╭────────────────────── Deprecated since version 1.5 ──────────────────────╮
│ Use the new API instead.                                                 │
╰──────────────────────────────────────────────────────────────────────────╯
╭───────────── Deprecated since version 1.5 (removed in 2.0) ──────────────╮
│ Removed in 2.0. Use the new API.                                         │
╰──────────────────────────────────────────────────────────────────────────╯

Sphinx Cross-Reference Roles

Sphinx Cross-Reference Roles Showcase

Sphinx cross-reference roles render as inline literals. Here is a showcase of all supported roles:

- Function: :func:`os.path.join`
- Class: :class:`pathlib.Path`
- Method: :meth:`str.upper`
- Attribute: :attr:`os.sep`
- Module: :mod:`os.path`
- Exception: :exc:`ValueError`
- Object: :obj:`sys.path`
- Data: :data:`sys.version`
- Constant: :const:`math.pi`
- Term: :term:`decorator`
- Reference: :ref:`some-label`
- Document: :doc:`installation`
- Environment Variable: :envvar:`PYTHONPATH`
Sphinx cross-reference roles render as inline literals. Here is a showcase 
of all supported roles:

 • Function: os.path.join
 • Class: pathlib.Path
 • Method: str.upper
 • Attribute: os.sep
 • Module: os.path
 • Exception: ValueError
 • Object: sys.path
 • Data: sys.version
 • Constant: math.pi
 • Term: decorator
 • Reference: some-label
 • Document: installation
 • Environment Variable: PYTHONPATH

Python Domain Showcase

Python domain showcase

.. py:class:: App(config)
   :module: mypackage.app
   :platform: Unix, Windows
   :synopsis: High-level application object.
   :noindex:
   :canonical: mypackage.app.App

   App ties together the main runtime pieces.

   .. py:attribute:: App.name
      :type: str
      :value: demo

      Human-readable application name.

   .. py:property:: App.ready
      :type: bool

      Whether the application is ready to serve requests.

   .. py:method:: App.run(self, *args, **kwargs) -> int
      :async:

      Run the application event loop.

   .. py:classmethod:: App.build(cls, config) -> App
      :final:

      Construct an application instance.

   .. py:staticmethod:: App.version() -> str

      Return the current version string.

   .. py:data:: App.DEFAULT_TIMEOUT
      :type: float
      :value: 3.5

      Default timeout in seconds.

   .. py:function:: parse_config(text) -> dict[str, str]
      :deprecated:
      :canonical: mypackage.app.parse_config

      Parse configuration text.

      :param text: Raw configuration text.
      :returns: A mapping of configuration keys.
      :rtype: dict[str, str]

   .. py:exception:: AppError
      :platform: OS Independent

      Base exception for application errors.
╭────────────────────────── [class] App(config) ───────────────────────────╮
│ Attributes                                                               │
│   name: str                                                              │
│     Human-readable application name.                                     │
│   ready: bool                                                            │
│     Whether the application is ready to serve requests.                  │
│   DEFAULT_TIMEOUT: float                                                 │
│     Default timeout in seconds.                                          │
│                                                                          │
│ Details                                                                  │
│   Module: mypackage.app                                                  │
│   Canonical: mypackage.app.App                                           │
│   Platform: Unix, Windows                                                │
│   Synopsis: High-level application object.                               │
│   Flags: noindex                                                         │
│                                                                          │
│ App ties together the main runtime pieces.                               │
│                                                                          │
│ ╭─────────── [method] App.run(self, *args, **kwargs) -> int ───────────╮ │
│ │ Details                                                              │ │
│ │   Flags: async                                                       │ │
│ │                                                                      │ │
│ │ Run the application event loop.                                      │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ╭──────────── [classmethod] App.build(cls, config) -> App ─────────────╮ │
│ │ Details                                                              │ │
│ │   Flags: final                                                       │ │
│ │                                                                      │ │
│ │ Construct an application instance.                                   │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ╭──────────────── [staticmethod] App.version() -> str ─────────────────╮ │
│ │ Return the current version string.                                   │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ╭────────── [function] parse_config(text) -> dict[str, str] ───────────╮ │
│ │ Details                                                              │ │
│ │   Canonical: mypackage.app.parse_config                              │ │
│ │   Flags: deprecated                                                  │ │
│ │                                                                      │ │
│ │ Parse configuration text.                                            │ │
│ │                                                                      │ │
│ │ Parameters                                                           │ │
│ │   text                                                               │ │
│ │     Raw configuration text.                                          │ │
│ │                                                                      │ │
│ │ Returns                                                              │ │
│ │   dict[str, str]: A mapping of configuration keys.                   │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ╭──────────────────────── [exception] AppError ────────────────────────╮ │
│ │ Details                                                              │ │
│ │   Platform: OS Independent                                           │ │
│ │                                                                      │ │
│ │ Base exception for application errors.                               │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────╯

C Domain Showcase

C domain showcase

.. c:struct:: Config
   :synopsis: Runtime configuration for the C API.
   :noindex:

   .. c:member:: int timeout

      Timeout in seconds.

   .. c:member:: const char *name

      Display name.

   .. c:enum:: Mode

      .. c:enumerator:: MODE_FAST

         Fast mode.

      .. c:enumerator:: MODE_SAFE

         Safe mode.

   .. c:function:: int init_config(struct Config *config)

      Initialize a configuration object.

   .. c:macro:: DEFAULT_TIMEOUT

      Default timeout value.

   .. c:var:: int g_config_ready

      Indicates whether the configuration is ready.
╭──────────────────────────── [struct] Config ─────────────────────────────╮
│ Details                                                                  │
│   Synopsis: Runtime configuration for the C API.                         │
│   Flags: noindex                                                         │
│                                                                          │
│ ╭──────────────────────── [member] int timeout ────────────────────────╮ │
│ │ Timeout in seconds.                                                  │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ╭───────────────────── [member] const char *name ──────────────────────╮ │
│ │ Display name.                                                        │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ╭──────────────────────────── [enum] Mode ─────────────────────────────╮ │
│ │ ╭───────────────────── [enumerator] MODE_FAST ─────────────────────╮ │ │
│ │ │ Fast mode.                                                       │ │ │
│ │ ╰──────────────────────────────────────────────────────────────────╯ │ │
│ │ ╭───────────────────── [enumerator] MODE_SAFE ─────────────────────╮ │ │
│ │ │ Safe mode.                                                       │ │ │
│ │ ╰──────────────────────────────────────────────────────────────────╯ │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ╭───────── [function] int init_config(struct Config *config) ──────────╮ │
│ │ Initialize a configuration object.                                   │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ╭────────────────────── [macro] DEFAULT_TIMEOUT ───────────────────────╮ │
│ │ Default timeout value.                                               │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ╭────────────────────── [var] int g_config_ready ──────────────────────╮ │
│ │ Indicates whether the configuration is ready.                        │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────╯

C++ Domain Showcase

C++ domain showcase

.. cpp:class:: App
   :synopsis: A small C++ application wrapper.
   :noindex:

   .. cpp:member:: std::string name

      Application name.

   .. cpp:member:: std::size_t count

      Number of processed items.

   .. cpp:enum:: Mode

      .. cpp:enumerator:: Mode::Fast

         Fast mode.

      .. cpp:enumerator:: Mode::Safe

         Safe mode.

   .. cpp:function:: int run(App &app)

      Run the app.

   .. cpp:alias:: StringMap = std::unordered_map<std::string, std::string>

      Convenience alias for string maps.

   .. cpp:concept:: ConvertibleToString

      A concept for string-like types.
╭────────────────────────────── [class] App ───────────────────────────────╮
│ Details                                                                  │
│   Synopsis: A small C++ application wrapper.                             │
│   Flags: noindex                                                         │
│                                                                          │
│ ╭───────────────────── [member] std::string name ──────────────────────╮ │
│ │ Application name.                                                    │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ╭───────────────────── [member] std::size_t count ─────────────────────╮ │
│ │ Number of processed items.                                           │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ╭──────────────────────────── [enum] Mode ─────────────────────────────╮ │
│ │ ╭──────────────────── [enumerator] Mode::Fast ─────────────────────╮ │ │
│ │ │ Fast mode.                                                       │ │ │
│ │ ╰──────────────────────────────────────────────────────────────────╯ │ │
│ │ ╭──────────────────── [enumerator] Mode::Safe ─────────────────────╮ │ │
│ │ │ Safe mode.                                                       │ │ │
│ │ ╰──────────────────────────────────────────────────────────────────╯ │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ╭──────────────────── [function] int run(App &app) ────────────────────╮ │
│ │ Run the app.                                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ╭── [alias] StringMap = std::unordered_map<std::string, std::string> ──╮ │
│ │ Convenience alias for string maps.                                   │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ╭─────────────────── [concept] ConvertibleToString ────────────────────╮ │
│ │ A concept for string-like types.                                     │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────╯

JavaScript Domain Showcase

JavaScript domain showcase

.. js:class:: App(config)
   :module: mypkg.app
   :synopsis: Browser or runtime application wrapper.
   :noindex:

   .. js:attribute:: App.name

      The application name.

   .. js:method:: App.run(args)
      :async:

      Run the app.

   .. js:data:: App.VERSION

      Current version string.

   .. js:function:: parseConfig(text)

      Parse configuration text.

   .. js:module:: mypkg.app

      The module that exports the application.
╭────────────────────────── [class] App(config) ───────────────────────────╮
│ Details                                                                  │
│   Module: mypkg.app                                                      │
│   Synopsis: Browser or runtime application wrapper.                      │
│   Flags: noindex                                                         │
│                                                                          │
│ ╭──────────────────────── [attribute] App.name ────────────────────────╮ │
│ │ The application name.                                                │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ╭─────────────────────── [method] App.run(args) ───────────────────────╮ │
│ │ Details                                                              │ │
│ │   Flags: async                                                       │ │
│ │                                                                      │ │
│ │ Run the app.                                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ╭───────────────────────── [data] App.VERSION ─────────────────────────╮ │
│ │ Current version string.                                              │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ╭──────────────────── [function] parseConfig(text) ────────────────────╮ │
│ │ Parse configuration text.                                            │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ ╭───────────────────────── [module] mypkg.app ─────────────────────────╮ │
│ │ The module that exports the application.                             │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────╯

See Also

seealso directive

.. seealso::

   :func:`os.path.join`, :class:`pathlib.Path`
╭──────────────────────────────── See Also ────────────────────────────────╮
│ os.path.join, pathlib.Path                                               │
╰──────────────────────────────────────────────────────────────────────────╯

Toctree (Sphinx)

toctree directive

.. toctree::
   :maxdepth: 2
   :caption: Contents
   :name: custom-toctree-name
   :titlesonly:
   :glob:
   :hidden:
   :includehidden:
   :reversed:
   :numbered: 2

   Installation Guide <installation>
   Usage Instructions <usage>
   API Reference <api>
   guide/Advanced Topics <guide/api>
╭──────────────────────────────── Contents ────────────────────────────────╮
│   0.1. guide/Advanced Topics                                             │
│ 1. API Reference                                                         │
│ 2. Usage Instructions                                                    │
│ 3. Installation Guide                                                    │
╰──────────────────────────────────────────────────────────────────────────╯

toctree with numbered entries

.. toctree::
   :numbered:

   intro
   guide/installation
   guide/usage
   guide/api
╭──────────────────────────────── Contents ────────────────────────────────╮
│ 1. intro                                                                 │
│   1.1. guide/installation                                                │
│   1.2. guide/usage                                                       │
│   1.3. guide/api                                                         │
╰──────────────────────────────────────────────────────────────────────────╯

Glossary

glossary directive

.. glossary::

   RST
       reStructuredText — a lightweight markup language.

   Sphinx
       A documentation generator for Python projects.
╭──────────────────────────────── Glossary ────────────────────────────────╮
│ RST                                                                      │
│     reStructuredText — a lightweight markup language.                    │
│                                                                          │
│ Sphinx                                                                   │
│     A documentation generator for Python projects.                       │
╰──────────────────────────────────────────────────────────────────────────╯

glossary (sorted)

.. glossary::
   :sorted:

   Zebra
       A striped animal.

   Aardvark
       An ant-eating mammal.
╭──────────────────────────────── Glossary ────────────────────────────────╮
│ Aardvark                                                                 │
│     An ant-eating mammal.                                                │
│                                                                          │
│ Zebra                                                                    │
│     A striped animal.                                                    │
╰──────────────────────────────────────────────────────────────────────────╯

Mixed Sphinx Roles in Prose

Mixed roles in a paragraph

Use :func:`json.dumps` or :func:`json.loads` to serialize data.
The :class:`dict` type maps :class:`str` keys to values.
See :pep:`484` for type hints and :pep:`526` for variable annotations.
Press :kbd:`Ctrl+D` or call :func:`exit` to quit the REPL.
Use json.dumps or json.loads to serialize data. The dict type maps str keys 
to values. See PEP 484 for type hints and PEP 526 for variable annotations. 
Press Ctrl+D or call exit to quit the REPL.

This page was generated automatically. Run python tools/generate_demo_page.py from the repository root to refresh it.

Previous Next

© Copyright 2026, Wasi Master aka. Arian Mollik Wasi.

Built with Sphinx using a theme provided by Read the Docs.