Skip to main content

A beautiful reStructuredText renderer for rich

Project description

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, and admonition_style.

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, --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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rich_rst-2.1.0.tar.gz (302.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rich_rst-2.1.0-py3-none-any.whl (273.0 kB view details)

Uploaded Python 3

File details

Details for the file rich_rst-2.1.0.tar.gz.

File metadata

  • Download URL: rich_rst-2.1.0.tar.gz
  • Upload date:
  • Size: 302.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rich_rst-2.1.0.tar.gz
Algorithm Hash digest
SHA256 f4d117b49697f338769759fa5cacf5197da4888b347b9fda2e50aef5cd8d93bd
MD5 fef18f2367c0fa07d9e6b50b43648b96
BLAKE2b-256 e2d6d0b9fafc73b65767200da027acab1db1bdb1048f4fea5ebf659df01c700e

See more details on using hashes here.

Provenance

The following attestation bundles were made for rich_rst-2.1.0.tar.gz:

Publisher: publish.yaml on wasi-master/rich-rst

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rich_rst-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: rich_rst-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 273.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rich_rst-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ecd1343ee12c879d0e7ae74c3eb6d263b023d2929c6d114212eb1fd91057255
MD5 d681d4450970c0a059553f588a58168f
BLAKE2b-256 2a681fc93dd759605b5d00fc98b50200739e41ed32bd22d6ba35ca6c3932371b

See more details on using hashes here.

Provenance

The following attestation bundles were made for rich_rst-2.1.0-py3-none-any.whl:

Publisher: publish.yaml on wasi-master/rich-rst

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page