Pretty printing XML
tidy is a command line tool for formatting XML and HTML. Also available as a Visual Studio Code Extension
What is tidy?
It’s a very unslick util for tidying up HTML markup which gets the job done. To install it on OS X, simply do
❯ brew install tidy
Tidy usage
To pretty print input.xml
and save the output to pretty_printed.xml
❯ tidy -xml -i input.xml > pretty_printed.xml
There are several command line options. For example, to change the case of tabs to uppercase:
❯ tidy -xml --uppercase-tags y -i input.xml
Visual Studio Code
To install it on VSCode, just search for “Tidy” in the Extension Panel. Then you can use from the command panel (CMD-SHIFT-P) by simply typing “tidy”