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.2.tar.gz
(13.9 kB
view details)
Built Distribution
File details
Details for the file ansiparser-1.3.2.tar.gz
.
File metadata
- Download URL: ansiparser-1.3.2.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 516b9ce443b9a385cdd243bec5cf6405a40c2b5321ccdb7b43525fc93359624a |
|
MD5 | 04a3b656de840f52b0029a608c055e0e |
|
BLAKE2b-256 | 3fe7678d787ad47ac49f316e912d418bed0d6d4b030149bdb625b9ac646d0b21 |
File details
Details for the file ansiparser-1.3.2-py3-none-any.whl
.
File metadata
- Download URL: ansiparser-1.3.2-py3-none-any.whl
- Upload date:
- Size: 16.7 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 | b4581dac3cde29d94c30f7de657d88a26ae860f20fce3ef11578fab7f6ece321 |
|
MD5 | bc65a9d76cf28349fc6505bcfc4be1c7 |
|
BLAKE2b-256 | e4c1a9ed1a41d61439253c447f7d7b147b8cc688cbb6ee3b14c027d4df135e00 |