Makers of fine websites since 1994
Knowledge is wonderful thing

XTH – the XHTML to HTML converter for wordpress

Posted by John Kilroy September 9th, 2009

By popular demand here it is – version 2.01 of the original XHTML-to-HTML wordpress plugin. Now called XTH (bit catchier, no?), it is a complete rewrite of the original version and aims to fix the Javascript CDATA and RSS feed issues that the original suffered.

Caveats

OK, this version seems to successfully avoid parsing inline Javascripts and external Javascript libraries. This is necessary because the XHTML closing sequence is a valid pattern in javascript regex, and removing it from those places would mess up those libraries.
The downside to that is that it’s then up to you to make sure that any JS you use doesn’t output any XHTML, as XTH no longer ‘fixes’ it for you.
Same goes for any other external libs that you or your plugins load.

Note that XTH doesn’t address javascript URLs of the form <a href=”javascript:foo()”>. This is for efficiency – and also because I haven’t ever seen a regex used in that context, but who knows, someone might try it. I might add this as an option in a future

Don’t forget!

A single XHTML closer anywhere in the output will fail HTML 4.01 validation Resulting in tag soup and defeating the object of the whole exercise.

XTH also avoids RSS feeds.

Problems, bugs and comments below please. This is a complete rewrite of the plugin so we’re back to square one with the list of problems and required tweaks.

Thanks to all those people who gave feedback and whose time and knowledge helped to make this new version possible.

6 Responses to “XTH – the XHTML to HTML converter for wordpress”

  1. John Kilroy says:

    Fixed the weird Atom feed error. Bizarrely the conditional WP is_feed() function doesn’t work when tested outside XTH’s main routine. Placed inside it does now work – your Atom feeds are safe once more :)

  2. Great work. This plugin will really come in handy for those transitioning to HTML 5. Myself, I’m waiting for it to become a final spec. And when it does and WordPress hasn’t yet caught up, this plugin will become very popular.

  3. Fabio says:

    Thanks for the plugin that makes it easier.

    ObrigadoFabio / Brazil / Sao Paulo.

  4. Jonathan says:

    Awesome plugin; thanks for writing it.

  5. David says:

    This plugin has preserved my sanity. I had 52 errors but now, thanks to XTH, they are gone. Thanks again!

  6. [...] but not using any HTML5 specific features as outlined in the above paragraph. Thanks to the free XTH plugin which helped with making the [...]

Reply to this post

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.