Perfectly convert ANSI escape codes into HTML.


Perfectly convert ANSI escape codes to HTML.

npm install termio
ls --color=always | termio > ls.html
termio < tmux.output > tmux.html
var Termio = require('termio');
  • Everything is a <span>
  • There are no inline style attributes. All styles must be applied with CSS. E.g. <span class="foreground-1">
0reset all styles
1bolduse bold font and bright colors
3italicuse italic font
4underlineunderline text
7reverseswitch background and foreground colors
8concealdisplay nothing
9strikeline through text
21remove bold
22remove bold
23remove italic
24remove underline
27remove reverse
28remove conceal
29remove strike
30foreground-0set foreground to 0
31foreground-1set foreground to 1
32foreground-2set foreground to 2
33foreground-3set foreground to 3
34foreground-4set foreground to 4
35foreground-5set foreground to 5
36foreground-6set foreground to 6
37foreground-7set foreground to 7
38foreground-nset foreground to n
39foreground-fgset foreground to fg
40background-0set background to 0
41background-1set background to 1
42background-2set background to 2
43background-3set background to 3
44background-4set background to 4
45background-5set background to 5
46background-6set background to 6
47background-7set background to 7
48background-nset background to n
49background-bgset background to bg
90foreground-8set foreground to 8
91foreground-9set foreground to 9
92foreground-10set foreground to 10
93foreground-11set foreground to 11
94foreground-12set foreground to 12
95foreground-13set foreground to 13
96foreground-14set foreground to 14
97foreground-15set foreground to 15
100background-8set background to 8
101background-9set background to 9
102background-10set background to 10
103background-11set background to 11
104background-12set background to 12
105background-13set background to 13
106background-14set background to 14
107background-15set background to 15