Tidy is a tool that automatically fixes errors in your HTML, validates it and pretty prints it. Tidy's output can be customized to your needs. Some HTML documentation is available in ${PREFIX}/share/doc/tidy.