Crates.io | ansi-to-html |
lib.rs | ansi-to-html |
version | 0.2.1 |
source | src |
created_at | 2020-11-13 18:25:47.146391 |
updated_at | 2023-11-30 18:57:28.383287 |
description | ANSI escape codes to HTML converter |
homepage | https://github.com/Aloso/to-html/tree/master/crates/ansi-to-html |
repository | https://github.com/Aloso/to-html |
max_upload_size | |
id | 312055 |
size | 37,423 |
Rust library to convert a string that can contain ANSI escape codes to HTML.
This crate currently supports SGR parameters (text style and colors). The supported styles are:
Not supported SGR parameters (note that most of these are niche features and rarely supported by terminals):
All unsupported ANSI escape codes are stripped from the output.
It should be easy to add support for more styles, if there's a straightforward HTML representation. If you need a different style (e.g. doubly underlined), file an issue.
When the lazy-init
feature is enabled, regexes are lazily initialized, which is more efficient if you want to convert A LOT of strings. The performance difference has not been tested.