Command-line HTML formatter that doesn't modify HTML in any way, just indents? Command-line HTML formatter that doesn't modify HTML in any way, just indents? shell shell

Command-line HTML formatter that doesn't modify HTML in any way, just indents?


Try opening it in vim (a file editor) then use this:

gg=G

That will reindent (=) every line from the first line (gg) to the last (G). It will only work if the new lines already exist. If you need to insert new lines you could add a regex to look for close tags and then insert a new line.

%s/\>/\>\\n/g

%s whole file regex match closing tag > and replace with > new line.

If you're new to vim you can use :wq to write (w)[save] and quit q