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

✨ 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-0.0.1.tar.gz (13.6 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for ansiparser-0.0.1.tar.gz
Algorithm Hash digest
SHA256 53032b075019f19b03269e3842ded12b7866815e91b372435b0c58781c952d21
MD5 5eca6e00c1e57d0075ff09fb3d6a509b
BLAKE2b-256 b47d199a091d70329c08f278cc383d87cbc6cc9cdf683481dc4438ca15db6766

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