HTML Tidy for WordPress

A note from A Beautiful Site’s founder: We developed Surreal to be easy for you and your clients. If you’re a web designer, you should take a look at the simple, hosted CMS that’s changing the way content is managed. Surreal integrates in moments and is trusted by over 18,000 websites. Try it out for free and let us know what you think! Visit Website »

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.

If you enjoyed this article, please share it with a friend!

2 Responses to HTML Tidy for WordPress

  1. Hey Cory,

    Thank you for writing about my plugin!
    And about that dependency – I’m with you on that and currently developing a plugin version that doesn’t require Tidy anymore (with the aforementioned HTML purifier). As for now, I just didn’t know there was a demand for that, so I’ll accelerate development.

    For php5-tidy on CentOS, you might try this.

    Thanks again!
    - Ben

  2. Cory LaViska says:

    Ben, thanks for the tip. I’m sure you’ll have a killer plugin once that Tidy dependency is out of the way (I will definitely use it!). Keep me updated on your progress and I’ll be happy to give the new version its own writeup :)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>