I’m looking for recommendations for HTML pretty printers which fulfill the following requirements:
- Takes HTML as input, and then output a nicely formatted/correctly indented but “graphically equivalent” version of the given input HTML.
- Must support command-line operation.
- Must be open-source and run under Linux.
Have a look at the HTML Tidy Project: http://www.html-tidy.org/
There used to be a fork called tidy-html5 which since became the official thing. Here is its GitHub repository.
For your needs, here is the command line to call Tidy: