Pretty Print HTML in Ruby (or Shell) Pretty Print HTML in Ruby (or Shell) unix unix

Pretty Print HTML in Ruby (or Shell)


In shells, another option is to use pup without arguments:

pup

XmlStarlet also supports using an HTML parser. fo is short for format. See xml fo -h for help.

xml fo --html

The main implementation of tidy does not support HTML5 but tidy-html5 does. brew install tidy-html5 installs tidy-html5 as /usr/local/bin/tidy in OS X.