ansi2htmlis a much better solution. Why didn't I think of it before 😅🤷♂️?
- Tested on macOS but should work on Linux.
- Requires Node.js (any recent version will do).
- Put
package.jsonandconvert.jsin the same dir, and runnpm ithere. - In macOS Terminal, run shell command and redirect its stdout or stderr to a file, e.g.
gls --color ~/Documents > gls-output.txt. - Run
node convert gls-output.txt. - Open
out.htmlin your browser.