HTMLize colour output from shell command with aha

aha is a tool to convert your colorized console output to HTML. For example, the following commmand: grep --color=always native Makefile | aha will produce the following output: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- This file was created with the aha Ansi HTML Adapter. https://github.com/theZiz/aha --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="application/xml+xhtml; charset=UTF-8" /> <title>stdin</title> </head> <body> <pre> # In this case, the paths written to 'src/epaths.h' must be in <span style="font-weight:bold;color:red;">native</span> ### Install <span style="font-weight:bold;color:red;">native</span> compiled Lisp files. find <span style="font-weight:bold;color:red;">native</span>-lisp -type d -exec $(MKDIR_P) &quot;$(ELN_DESTDIR){}&quot; \; ; \ find <span style="font-weight:bold;color:red;">native</span>-lisp -type f -exec ${INSTALL_DATA} &quot;{}&quot; &quot;$(ELN_DESTDIR){}&quot; \; -rm -rf <span style="font-weight:bold;color:red;">native</span>-lisp </pre> </body> </html> By default aha adds the HTML header, you can run with -n option to prevent this behaviour. Then you can paste your HTML code and it will give this: # In this case, the paths written to 'src/epaths.h' must be in native ### Install native compiled Lisp files. find native-lisp -type d -exec $(MKDIR_P) "$(ELN_DESTDIR){}" \; ; \ find native-lisp -type f -exec ${INSTALL_DATA} "{}" "$(ELN_DESTDIR){}" \; -rm -rf native-lisp