A beautiful reStructuredText renderer for rich
Project description
rich-rst
Allows rich to print a reStructuredText document in a rich format similar to rich.Markdown.
Features
75 supported reStructuredText elements. For a list see ELEMENTS.md
Command line interface
Show the contents of readme.rst
python -m rich_rst readme.rst
Get from stdin
python -m rich_rst -
For more help see python -m rich_rst --help
Usage
Note: There are some aliases: RST, reST, ReStructuredText, reStructuredText, RestructuredText
from rich_rst import RestructuredText
from rich import print
print(RestructuredText("This is a **test** document"))
Advanced usage
from rich_rst import RestructuredText
from rich import print
# Documentation for discord.py: https://pypi.org/project/discord.py
docs = "discord.py\n==========\n\n.. image:: https://discord.com/api/guilds/336642139381301249/embed.png\n :target: https://discord.gg/r3sSKJJ\n :alt: Discord server invite\n.. image:: https://img.shields.io/pypi/v/discord.py.svg\n :target: https://pypi.python.org/pypi/discord.py\n :alt: PyPI version info\n.. image:: https://img.shields.io/pypi/pyversions/discord.py.svg\n :target: https://pypi.python.org/pypi/discord.py\n :alt: PyPI supported Python versions\n\nA modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python.\n\nKey Features\n-------------\n\n- Modern Pythonic API using ``async`` and ``await``.\n- Proper rate limit handling.\n- 100% coverage of the supported Discord API.\n- Optimised in both speed and memory.\n\nInstalling\n----------\n\n**Python 3.5.3 or higher is required**\n\nTo install the library without full voice support, you can just run the following command:\n\n.. code:: sh\n\n # Linux/macOS\n python3 -m pip install -U discord.py\n\n # Windows\n py -3 -m pip install -U discord.py\n\nOtherwise to get voice support you should run the following command:\n\n.. code:: sh\n\n # Linux/macOS\n python3 -m pip install -U \"discord.py[voice]\"\n\n # Windows\n py -3 -m pip install -U discord.py[voice]\n\n\nTo install the development version, do the following:\n\n.. code:: sh\n\n $ git clone https://github.com/Rapptz/discord.py\n $ cd discord.py\n $ python3 -m pip install -U .[voice]\n\n\nOptional Packages\n~~~~~~~~~~~~~~~~~~\n\n* PyNaCl (for voice support)\n\nPlease note that on Linux installing voice you must install the following packages via your favourite package manager (e.g. ``apt``, ``dnf``, etc) before running the above commands:\n\n* libffi-dev (or ``libffi-devel`` on some systems)\n* python-dev (e.g. ``python3.6-dev`` for Python 3.6)\n\nQuick Example\n--------------\n\n.. code:: py\n\n import discord\n\n class MyClient(discord.Client):\n async def on_ready(self):\n print('Logged on as', self.user)\n\n async def on_message(self, message):\n # don't respond to ourselves\n if message.author == self.user:\n return\n\n if message.content == 'ping':\n await message.channel.send('pong')\n\n client = MyClient()\n client.run('token')\n\nBot Example\n~~~~~~~~~~~~~\n\n.. code:: py\n\n import discord\n from discord.ext import commands\n\n bot = commands.Bot(command_prefix='>')\n\n @bot.command()\n async def ping(ctx):\n await ctx.send('pong')\n\n bot.run('token')\n\nYou can find more examples in the examples directory.\n\nLinks\n------\n\n- `Documentation <https://discordpy.readthedocs.io/en/latest/index.html>`_\n- `Official Discord Server <https://discord.gg/r3sSKJJ>`_\n- `Discord API <https://discord.gg/discord-api>`_\n\n\n"
print(RestructuredText(docs, code_theme="dracula", show_errors=False))
Changelog
A changelog can be found in CHANGELOG.md
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rich_rst-1.3.2.tar.gz.
File metadata
- Download URL: rich_rst-1.3.2.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1196fdddf1e364b02ec68a05e8ff8f6914fee10fbca2e6b6735f166bb0da8d4
|
|
| MD5 |
df6a8d4cb0c6ef94ce451dcdd68790f4
|
|
| BLAKE2b-256 |
bc6da506aaa4a9eaa945ed8ab2b7347859f53593864289853c5d6d62b77246e0
|
File details
Details for the file rich_rst-1.3.2-py3-none-any.whl.
File metadata
- Download URL: rich_rst-1.3.2-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a99b4907cbe118cf9d18b0b44de272efa61f15117c61e39ebdc431baf5df722a
|
|
| MD5 |
7fa1cafa21ff78ddff8bc3138a2c658b
|
|
| BLAKE2b-256 |
132fb4530fbf948867702d0a3f27de4a6aab1d156f406d72852ab902c4d04de9
|