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 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, 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, --default-lexer, --show-errors, --save-html, --html-theme, --list-html-themes, --output, 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.0.0a9.tar.gz (282.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.0a9-py3-none-any.whl (264.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rich_rst-2.0.0a9.tar.gz
  • Upload date:
  • Size: 282.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.0a9.tar.gz
Algorithm Hash digest
SHA256 576771be53d8121c7b88ea83abb21b45460be8586b3d50b3c4ff4b1b0385ae31
MD5 fbd7183540eb291818413e1e5d5c17a6
BLAKE2b-256 f5307360bdd7bf3ca4d68520d43ca685336c6df45cfc66126b5311b6d24dc76b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rich_rst-2.0.0a9-py3-none-any.whl
  • Upload date:
  • Size: 264.5 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.0a9-py3-none-any.whl
Algorithm Hash digest
SHA256 1dc2ec6612986b7b4e891f7f66427ce9705fbd23ac23bd690157d14227e9b13c
MD5 b3c6725841aa7c65ff814c29b6f07f7d
BLAKE2b-256 d67e0f51e400f1605d97c51f80a31dfb667c1f7f299e1b97dd54d88f8dbd0e02

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