Skip to main content

A convenient library for converting ANSI escape sequences into text or HTML.

Project description

AnsiParser

A convenient library for converting ANSI escape sequences into text or HTML.

GitHub last commit PyPI - Version GitHub License

📖 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.

Pypi: https://pypi.org/project/ansiparser/

✨ 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

🎨 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!']

📜 License

GitHub 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.0.0.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

ansiparser-1.0.0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file ansiparser-1.0.0.tar.gz.

File metadata

  • Download URL: ansiparser-1.0.0.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for ansiparser-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c57090a81c58a1a62917ca889115f33a5fa5fdaeeb061bf7543d2596310ae08e
MD5 97f346aa64dadd41c012a8b19ef5b622
BLAKE2b-256 32d2958570558dd35c6cfa91a1b633aebf324f06eeac443f3cc8ad3cd8a3dc3c

See more details on using hashes here.

File details

Details for the file ansiparser-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ansiparser-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for ansiparser-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22f8d017f1d6fe15462fa7447a0b15dc462c92a35f9c80bef455df9d4c4be1ca
MD5 8d96a0c2bd4af64e56c636f593152a40
BLAKE2b-256 6aa8676a83fb3c41fdec3ad6e44eaa3bcf6bf25992cd89e8300a2dee9e6619b0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page