You have an ugly HTML and you want to indent it nicely. For instance you want to scrape something from it, but first it would be a good idea to indent the source.
The program “
tidy” can do that. Create the following config file (
indent: auto indent-spaces: 2 quiet: yes tidy-mark: no
Then call tidy the following way:
$ tidy -config tidy_config.txt ugly.html > nice.html
Tip from here.