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.3.0.tar.gz
(13.8 kB
view details)
Built Distribution
File details
Details for the file ansiparser-1.3.0.tar.gz
.
File metadata
- Download URL: ansiparser-1.3.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 | 51c9d73185c3327edd7c7dbfe731837aedd5377c930a97292507bc55ac79cfa0 |
|
MD5 | 71b527238d5d69591dbc3c5bf2d10845 |
|
BLAKE2b-256 | eca606c4a43845ae1395eb8065584b104f6108f1c545a74d92d82b730c814eb9 |
File details
Details for the file ansiparser-1.3.0-py3-none-any.whl
.
File metadata
- Download URL: ansiparser-1.3.0-py3-none-any.whl
- Upload date:
- Size: 16.5 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 | a6f63e9798d340056cca2496289ec5224baf078b1882f999388214dead8f4b5a |
|
MD5 | 6dc1149e4558374f5b3e13fc74d6b27e |
|
BLAKE2b-256 | a162341d4b7fcbfdb70a5907a6daaa3c970d42b595b48aaecfb6472beaa5aecd |