Render Markup to Terminal
Project description
terminal-markup
Render Markup to Terminal.
Inspired by tml.
Pros:
- Faster than alternatvies like
rich
. - Supports background colors and hex.
- Null-dependency.
Install:
pip install terminal-markup
poetry add terminal-markup
After install you can use command terminal-markup
.
Examples
from terminal_markup import render
# let's render bricks
print(render("[b][color=#f70000 background=yellow] WARNING [/color]:[/b] [purple]Life leads to [i blue underline]Death[/i].[/purple]"))
Tags
Tag | Description |
---|---|
b , bold |
Bold text |
i , em |
Italic text |
u |
Underline text |
blink |
-- |
dim |
Dimmed color |
rev |
Reversed foreground and background colors |
[color=<color>] , <color name> |
Set foreground color |
Non-existent tags do not cause errors.
Common attributes
Attribute | Description |
---|---|
<color name> , color=<color> |
Set foreground color |
background=<color> |
Set background color |
{bold|italic|underline|dim|reversed|blink}[={no|off|false|0|...}] |
Set style |
Unknown attributes are ignored.
Colors
Color names: black, maroon, green, olive, navy, purple, teal, silver, grey, red, lime, yellow, blue, fuchsia, aqua, white (first 16 colors from here). Also supported HEX-codes like #87CEEB
.
Tags Escaping
\[
- escaped[
.
Case Insensetive
Tag names, attributes and color names are case insensetive.
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
terminal_markup-0.2.8.tar.gz
(7.6 kB
view hashes)
Built Distribution
Close
Hashes for terminal_markup-0.2.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a365f5ef96e0d3a3e1bcfc05726d3d2619ab48d694dac4c8e13fc9b09ca5eeac |
|
MD5 | 6f8f9b9275beac7a7e4ecdb5c148fe6e |
|
BLAKE2b-256 | 9734e7a54d9d222e4d94819781d53085aa44047b358ede4252bb2e702b2b8b44 |