Converts Markup to Terminal ANSI Escape Codes
Project description
terminal-markup
Converts Markup to Terminal ANSI Escape Codes.
Inspired by tml.
Pros:
- Faster than alterntavies like
rich
. - Supports background color and hex-colors.
- Null-dependency.
Install:
pip install terminal-markup
poetry add terminal-markup
After install you can use comand terminal-markup
.
Examples
from terminal_markup import convert
print(convert("[b][color=#f70000 background=yellow] WARNING [/color]:[/b] [magenta]Life leads to [i blue underline]Death[/i].[/magenta]"))
Tags
Tag | Description |
---|---|
b |
Bold text |
i |
Italic text |
u |
Underline text |
[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}[={no|off|false|0|...}] |
Set text style |
Unknown attributes are ignored.
Colors
Color name: black
, red
, green
, yellow
, blue
, magenta
, cyan
, white
. Also supported HEX-codes like #deadbeef
.
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.2.tar.gz
(6.3 kB
view hashes)
Built Distribution
Close
Hashes for terminal_markup-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d031a9304b6643a15404e38f32c30035f96f12c35c563680fad9f0c28b83736 |
|
MD5 | 8c166e60025d611d501d7ae6e6315481 |
|
BLAKE2b-256 | 9001542216ef564c3cbb3c24dd5024bc95f2c1c2f33c1ce7b7c88ef22c2bc7f8 |