rburns / ansi-to-html

Convert ansi escaped text streams to html.
MIT License
357 stars 48 forks source link

No support to convert \t? #79

Open kekekedeng opened 4 years ago

kekekedeng commented 4 years ago

I want to output bash output on web page, but this lib only convert ANSI color code and no supporting for '\t' and others. image

rburns commented 4 years ago

what is the expected result, and the current output? I think in the context of html one or more spaces, or a tab character is rendered as a single space. ie if the tab character is passed through, it wouldn't be visible in the rendering.

there is a pull request here to optionally translate whitespace to html elements https://github.com/rburns/ansi-to-html/pull/70. the newline option currently does that for newlines, though not other whitespace characters. https://github.com/rburns/ansi-to-html#options

the two tests here indicate that the intended default behaviour is to render whtespace as whitespace, though we are missing tests for the tab character.

jorisw commented 3 years ago

Prepend your output with <pre> and the tabs will show.