Markdown-like admonitions from the comfort of your favorite terminal, all thanks to `rich`!
Project description
rich-admonitions
Markdown-like admonitions from the comfort of your terminal, all thanks to rich
!
Note
Credit where it's due! The structure of this project was set up with the ever-helpful PyScaffold. And thanks to the Textualize developers for their help with debugging and developing this class!
Overview
I think Julia's REPL admonitions are so neat.
julia> using Markdown
julia> md"""
!!! note
Check out this helpful note!
"""
│ Note
│
│ Check out this helpful note!
Thanks to rich
, it's not difficult to replicate this format with a Python class!
>>> from admonitions import Admonition
>>> Admonition.note("Check out this helpful note!")
│ Note
│
│ Check out this helpful note!
Installation & Usage
This package is installable through the public PyPi index.
python -m pip install rich-admonitions
And it's use-able through the name admonitions
!
import admonitions
Any type that is renderable by rich
can go in the Admonition
constructor!
>>> from rich.markdown import Markdown
>>> message = """
... # Mic Test
...
... Testing, testing! Is this thing on?
... """
>>> Admonition(Markdown(message))
│ Notice
│
│ ╔══════════════════════════════════════════════════════════════════════╗
│ ║ Mic Test ║
│ ╚══════════════════════════════════════════════════════════════════════╝
│
│ Testing, testing! Is this thing on?
And there a few out-of-the-box class methods to get you started. 😊
>>> Admonition.note(
... Admonition.tip(
... Admonition.warning(
... Admonition.danger(
... "Hold your breath! 🤿"
... )
... )
... )
... )
│ Note
│
│ │ Tip
│ │
│ │ │ Warning
│ │ │
│ │ │ │ Danger
│ │ │ │
│ │ │ │ Hold your breath! 🤿
│ │ │
│ │
│
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
Built Distribution
Hashes for rich_admonitions-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50a798de78f60f18efbd4571c84039e1a71086a3341b5b3ef9df6c3d361b6533 |
|
MD5 | 0d6ba75f45a88165875c89de31ad788a |
|
BLAKE2b-256 | 6476f469cbff10c3df0eac2cebcc2a7e2d2e48137a661de7dbba9af76edb010e |