HTML Tidy for WordPress

I was out and about in the SitePoint forums today and someone had a very simple request:

I would like to get the "generated source" (viewing the source in a browser) of WordPress to be properly formatted and indented.

It sounded simple enough and, as an OCD developer, I can understand why one might want their markup to look good underneath the hood.  After a bit of searching, I found exactly the thing that would do it.

HTML Tidy for WordPress is a plugin that runs your WordPress-generated pages through HTML Tidy.  The plugin requires the PHP Tidy module, which isn't usually installed by default.  Unfortunately, in previous attempts, I've found PHP Tidy rather difficult to install on my CentOS server.  Maybe there is a chance of seeing this plugin adapted to use a pure PHP-based solution such as HTML Purifier?  The plugin does support Hyper Cache, however, which means that it shouldn't put a drain on performance.

Overall, this is a really great idea, but eliminating that Tidy dependency would make this more useful to a wider range of developers.

Author avatar

About the author

Creator of Surreal CMS and other web things. Follow me for tweets about JavaScript, CSS, and web programming.