A convenient library for converting ANSI escape sequences into text or HTML.
Project description
AnsiParser
📖 Description
Parse ANSI escape sequences into screen outputs. This library implements a parser that processes escape sequences like a terminal, allowing you to convert them into formatted text or HTML.
✨ Supported Features
- CSI (Control Sequence Introducer) sequences
- SGR (Select Graphic Rendition)
- CUP (Cursor Position)
- ED (Erase in Display)
- EL (Erase in Line)
- Convert
- formatted text
- HTML
📦 Installation
AnsiParser is available on PyPI:
python -m pip install ansiparser
Or you can use Poetry:
poetry add ansiparser
🎨 Usage
import ansiparser
ansip_screen = ansiparser.new_screen()
ansip_screen.put("\x1b[1;6H-World!\x1b[1;1HHello")
ansip_screen.parse()
converted = ansip_screen.to_formatted_string()
print(converted) # ['Hello-World!']
🔗 Links
📜 License
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
ansiparser-1.2.0.tar.gz
(13.8 kB
view details)
Built Distribution
File details
Details for the file ansiparser-1.2.0.tar.gz
.
File metadata
- Download URL: ansiparser-1.2.0.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 601f5e3fae2f84b8b74788319185356523f47fe8beafbceca7c4bf85a442b435 |
|
MD5 | 81ff00e9f4afde4baa22c4706092eea2 |
|
BLAKE2b-256 | 22dc6f21f28115b1bce4427fd88c7e2b9d9a2f0e6e3ca89bee59e0e93fc6a6bb |
File details
Details for the file ansiparser-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: ansiparser-1.2.0-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38ee7879bfed4487c9a292ed10325caee787ab805974c597c85551887516d1c8 |
|
MD5 | 34df14b209d92bf438e707adb7548832 |
|
BLAKE2b-256 | a9d084939d28ba8338a6a1b17ef4faeafd5346d806515c75eabab799c390b7cf |