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.1.tar.gz
(13.9 kB
view details)
Built Distribution
File details
Details for the file ansiparser-1.3.1.tar.gz
.
File metadata
- Download URL: ansiparser-1.3.1.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 | 965bca26adccc2c924341e31c7b90d794c534d8342b81fb5adbcdc30ece7f205 |
|
MD5 | ae106063db0834c58822135bf785c070 |
|
BLAKE2b-256 | 3a213c911f9bcf89c1be2c31c9a6f39e154a570d1fb8e8a5d642a4090e520309 |
File details
Details for the file ansiparser-1.3.1-py3-none-any.whl
.
File metadata
- Download URL: ansiparser-1.3.1-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 | 1a870132eff5fe80e15a8aeb4293eb6b2388fa183a1329457d4b054bec18705c |
|
MD5 | ac99ba88894f6006b63156e789906db0 |
|
BLAKE2b-256 | cbc9ba332ad8eb7a1f12d0068b6cb20c5016288d3a6536ee67077976d6960e67 |