[wp-hackers] Outputting Clean Well Indented and Readable X/HTML

Dougal Campbell dougal at gunters.org
Sat Mar 12 18:47:56 UTC 2011

On Mar 12 2011 10:52 AM, Alex Andrews wrote:
> Surely there is an elegant solution to this - is there not, say,
> libraries for PHP to cleanup HTML output?

Pretty much the only way you will ever guarantee "pretty" HTML output is 
to buffer the whole page output and run it through something like 
htmltidy before sending it to the browser.

Most people are not going to consider this worth the effort. You'd be 
trading off a whole lot of server resources and page generation time for 
a result that practically nobody is ever going to see. I'm not saying 
that there might not be a plugin already that does this, I haven't 
looked. But it's not something *I* would use, because my server's CPU 
has better things to do with its time, like serving pages as fast as 

If I want pretty HTML, I'll save the source to a file, and run tidy on that.

Dougal Campbell <dougal at gunters.org>

More information about the wp-hackers mailing list