Googling around I have found that Perl CPAN has the HTML::FromANSI module. Also, this module installs ansi2html which accepts input from stdin.
ls --color | ansi2html -p > my_web_page.html
ls --color | ansi2html > my_snpipet_code-no_header-footer.html
But I prefer the default output from ansi2html.sh from pixelbeat
Unfortunately the ls --color get properly converted to HTML but the git one not. No matter which script I use. Could it be bacause the color is defined in the config as color.ui=auto?
git diff HEAD master -- ensembl/sql/CVS/Tag | ansi2html -p > ~/public_html/htdocs_dev/diff1.html
git diff HEAD master -- ensembl/sql/CVS/Tag | ansi2html.sh --bg=dark > ~/public_html/htdocs_dev/diff2.html
Yes! the problem would be that I have in the configuration color.ui=auto because explicitly having --color in the command make it work:
$ git diff --color HEAD master -- ensembl/sql/CVS/Tag | ansi2html.sh --bg=dark > ~/public_html/htdocs_dev/diff3.html