Terminal ansi to html convertor that uses libghostty-vt.
libghostty recently added functionality to encode terminal contents to HTML tweet. This npm package uses libghostty to encode terminal contents to HTML.
You can use it either as a library or as a binary to encode your terminal outputs in real time.
You can use your favorite package manager to install ghostty-ansi-html.
bun add ghostty-ansi-htmlThe library is small and its designed to be similar to ansi-to-html.
import { Convert } from "ghostty-ansi-html";
var convert = new Convert();
console.log(convert.convert("\x1b[30mblack\x1b[37mwhite'"));
You can use it as bin using bunx/npx. You can see your terminal outputs using
neofetch | bun x ghostty-ansi-html