Settings

Theme

Show HN: Fancy-ANSI – Small JavaScript library for converting ANSI to HTML

github.com

16 points by andres 2 years ago · 11 comments · 1 min read

Reader

I made this tool to add support for custom ANSI palettes to kubetail (https://github.com/kubetail-org/kubetail). Maybe you'll find it useful too.

Let me know if you have any suggestions!

giraffe_lady 2 years ago

Ah this is awesome. I've been working on a browser based mud client and none of the existing options handled everything I needed. I'll be switching to this immediately, it seems to solve all of my current problems with displaying ansi text in the browser.

  • andresOP 2 years ago

    Awesome! Great to hear it's useful for your project. Let me know if you have any questions or run into any issues.

epage 2 years ago

Recently did something similar in Rust but for generating SVGs. We've adopted it for snapshot testing of cargo and rustc's output. Don't have a good PR handy for showing Github's rendering of changes in the SVG (text, side-by-side, swiping) but https://github.com/rust-lang/rust/pull/121877/files has newly added SVGs.

To see what is supported, see the screenshot in the docs: https://docs.rs/anstyle-svg/latest/anstyle_svg/

blueflow 2 years ago

It is unclear to what extent the ANSI control codes are implemented. The README mentions SGR and the 24-bit color extensions in the nonstandard semicolon syntax. What about cursor movements? Backspace? Overstriking?

Which "ANSI" did you use as reference?

chrismorgan 2 years ago

Simple bug report: an empty SGR (CSI m, ) doesn’t do anything, but should be equivalent to 0, reset all.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection