Skip to main content

A beautiful reStructuredText renderer for rich

Project description

rich-rst

Documentation Status

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 89 of the 98 documented docutils elements. See ELEMENTS.md for the full support matrix.
  • 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, and sphinx_compat.

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, --show-errors, and --save-html.

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.0.0a2.tar.gz (48.9 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.0.0a2-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file rich_rst-2.0.0a2.tar.gz.

File metadata

  • Download URL: rich_rst-2.0.0a2.tar.gz
  • Upload date:
  • Size: 48.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for rich_rst-2.0.0a2.tar.gz
Algorithm Hash digest
SHA256 89adde4255a369a1247c6108f3b8c85c8ebc58b939decda93941675eb8fca42c
MD5 691db5f87db69f6f54ac603e82e73f0c
BLAKE2b-256 5e33f23e3d89385544964636cfb7e35121782d52371b082c6fc01442d3df96e8

See more details on using hashes here.

File details

Details for the file rich_rst-2.0.0a2-py3-none-any.whl.

File metadata

  • Download URL: rich_rst-2.0.0a2-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for rich_rst-2.0.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 0510357522b84001b911e287ce07946980e7720d3c1239cddafe75d6254b7b94
MD5 7a1e639e3ff7441264e08a9b9867db6e
BLAKE2b-256 bdcfbc00c6de2094efbf2e3a85ffbed8228edf9e669b9de264cdaf7058beaf2e

See more details on using hashes here.

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