Skip to main content

Logo

rich-rst

Documentation Status Tests Status CodeQL Status Codecov

Render reStructuredText with Rich. This package turns reST documents into Rich renderables so you can preview documentation, docstrings, and snippets directly in the terminal. Also includes a CLI.

Highlights

  • Supports all currently documented RST elements.
  • Handles common documentation features such as headings, lists, tables, links, images, code blocks, footnotes, and many Sphinx roles.
  • Provides both a Python API and a command-line interface.
  • Can also export rendered output to HTML from the CLI.

Installation

pip install rich-rst

Python API

from rich import print
from rich_rst import RestructuredText

document = """
rich-rst
========

This is a **test** document.

- Item one
- Item two

.. code-block:: python

   print("hello")
"""

print(RestructuredText(document))

The main constructor options are code_theme, show_line_numbers, show_errors, guess_lexer, default_lexer, sphinx_compat, admonition_style, and allow_file_access.

Directives that read other files (include, literalinclude, and raw/csv-table with :file: or :url:) are disabled by default. Pass allow_file_access=True to enable them, but only for markup you trust.

Command Line Interface

Render a file:

python -m rich_rst readme.rst

Render from standard input:

python -m rich_rst -

View all available options:

python -m rich_rst --help

Useful flags include --code-theme, --show-line-numbers, --guess-lexer, --default-lexer, --show-errors, --allow-file-access, --admonition-style, -S/--save-html, --html-theme, --list-html-themes, --output, --debug, and --version.

Compatibility

The renderer is designed for terminal output, so not every docutils feature can be represented visually. The current limitations and unsupported elements are documented in ELEMENTS.md.

Documentation

Changelog

See CHANGELOG.md.

Metadata

Release files for rich-rst 2.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rich-rst 2.2.0
File Size Uploaded
rich_rst-2.2.0.tar.gz 326.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rich-rst 2.2.0
File Interpreter ABI Platform
rich_rst-2.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 605.5 kB

Release files / rich_rst-2.2.0.tar.gz

Download URL rich_rst-2.2.0.tar.gz
Size 326.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b1e6a67f8f694a6f36035624bf73e2b1a0a4be13edaf3ba5e654d9758b61073a
BLAKE2b-256 checksum
How to use checksums
cf0efaf7c7e36630561e3e9611730c47510cd972dd5fde8f95941ff78f76accd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / rich_rst-2.2.0-py3-none-any.whl

Download URL rich_rst-2.2.0-py3-none-any.whl
Size 279.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ea1c43813dc4a8d86475fce27ffb74e0ada3d4656c9f8130ba2a59868055fe9
BLAKE2b-256 checksum
How to use checksums
d14e716b42bf066e180c1235783b46f095a5d871d05dca7006d2295aac29c491
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page