Format an HTML document, indenting with 4 spaces

xml format

xml format --html --indent-spaces {{4}} {{path/to/input.html|URI}} > {{path/to/output.html}}

click the source code to copy install xml format on any operating system with command-not-found.com