HTML is a markup language rather than a programming language. You can specify how you want text to appear on a Web page with HTML, but you can't make decisions or change the contents of the page ...
For PHP, I don't know, but for HTML I use Tidy. I have no idea how it'll handle PHP, but if you have PHP embedded in your HTML, you probably have bigger problems than making it look good.
Attackers were able to place malicious code in the PHP central code repository by impersonating key developers, forcing changes to the PHP Group's infrastructure. Unknown attackers managed to break ...