Command Line – Converting Colored Output into HTML

colorscommand linediff()outputterminal

There are tools providing coloured output:

dwdiff -c File1 File2 # word level diff
grep --color=always # we all know this guy
...

The question is: How to convert their colored output of arbitrary program into coloured html file?

Other output formats might be suitable as well (LaTeX would be great).
I think html is good starting point, as it's easy to convert it to other formats.

(For curious how to keep terminal colour codes, please follow answer:
https://unix.stackexchange.com/a/10832/9689
... | unbuffer command_with_colours arg1 arg2 | ... – tool unbuffer is part of expect )

Best Answer

The answer to this question is probably what you want.

It links to these tools, which do the conversion you're looking for: