ansi2html(1)

πŸ“¦
version 2.7 Β· 4 versions
, in debian bookworm, debian trixie, epel 10, epel 9, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

okay bestie, the manual name here is ansi2html, and it's an ansi to HTML converter ✨


✨ SYNOPSIS ✨

ansi2html [-nwctl] <log >outfile

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so ansi2html takes your ANSI log and turns it into an HTML page 🌈 It converts the ANSI color codes into the right tags, and all the common colors and attributes are supported. full glam, no notes πŸ’…


πŸŽ€ OPTIONS πŸŽ€

  • -n, --no-header β€” skips the HTML header 🫢 This is perfect if you wanna drop the log into a web page you're building another way. Just know that you're on the hook for the background color. Go black or something dark in the default on-black mode, or white/light when -w is used. Fancy background images are cute too, as long as they're dark (or light) enough πŸŒ™
  • -w, --white β€” makes the background white 🀍 Yes, it's the opposite of most terminals, but it matches most webpages 🌸 Text that's asking to be bolded (normally bright white) turns bold black. BUT explicit bright white stays put and becomes invisible πŸ™ˆ That's the same deal as explicit black being invisible in the normal on-black mode, just like on real terminals (see -c).
  • -c, --contrast β€” no invisible text allowed πŸš«πŸ‘» Whenever the foreground color matches the background, it gets shifted halfway across the color space, so white and black both turn into gray 🩢 ngl this is inaccurate compared to real terminals πŸ’€ But most web users already know how to mouse-highlight "spoiler" text, so it's still useful if you're processing logs that assume a different white-vs-black background than yours.
  • -t, --title text β€” sets the page title to the next argument 🏷️ Mutually exclusive with -n, so don't pair them, bestie πŸ™…β€β™€οΈ
  • -l, --no-wrap β€” turns off word-wrapping πŸ“œ By default, ansi2html wraps text like a real terminal does, which is the opposite of what browsers usually do with plain text. Chaotic, but make it make sense.
  • --style text β€” injects some text into the stylesheet πŸ’œ It obviously doesn't make any sense with -n πŸ™ƒ Example:
--style 'pre {font-family: Consolas}'

🚨 CAVEATS 🚨

⚠️ heads up: most ANSI codes that aren't color codes get ignored, which can lead to misformatted output πŸ’€ In general, anything that wouldn't work on a hardcopy terminal won't work here either.

🌷 SEE ALSO 🌷

ansi2txt(1), ttyrec2ansi(1), pipetty(1). Go check those out, they're giving main character energy πŸ‘‘


That's the whole tea, bestie 🫢 This page was last updated 2018-05-27, and it's still ansi2html(1) iconic 🌈 ttyl πŸ’…βœ¨