Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/s3rgeym/terminal-markup
Render Markup to Terminal.
https://github.com/s3rgeym/terminal-markup
Last synced: 1 day ago
JSON representation
Render Markup to Terminal.
- Host: GitHub
- URL: https://github.com/s3rgeym/terminal-markup
- Owner: s3rgeym
- License: mit
- Created: 2023-12-27T11:19:33.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-01-04T10:12:29.000Z (10 months ago)
- Last Synced: 2024-10-31T08:47:54.175Z (7 days ago)
- Language: Python
- Homepage:
- Size: 64.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# terminal-markup
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/terminal-markup)]() [![PyPI - Version](https://img.shields.io/pypi/v/terminal-markup)]() [![Total Downloads](https://static.pepy.tech/badge/terminal-markup)]()
Render Markup to Terminal.
Inspired by [tml](https://github.com/liamg/tml).
Pros:
* Faster than alternatvies like `rich`.
* Supports background colors and hex.
* Null-dependency.Install:
```bash
pip install terminal-markup
poetry add terminal-markup
```After install you can use command `terminal-markup`.
## Examples
```python
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]"))
```![image](https://github.com/s3rgeym/terminal-markup/assets/12753171/b3681eff-dff3-4964-a6fe-0329a4829156)
## 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=]`, `` | Set foreground color |Non-existent tags do not cause errors.
## Common attributes
| Attribute | Description |
| -- | -- |
| ``, `color=` | Set foreground color |
| `background=` | 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](https://ss64.com/bash/syntax-colors.html)). Also supported HEX-codes like `#87CEEB`.
## Tags Escaping
> `\[` - escaped `[`.
## Case Insensetive
Tag names, attributes and color names are case insensetive.