Cleanup HTML comments formatting

Cleanup HTML comments formatting with pretty print enabled. Adds a more comprehensive test. Solves issue #1122