Support » Plugins » HTML Tidy

  • Anyone working on, or know of, a WP plugin for HTML Tidy? There was one recently availabe for MT; I never was able to get it to work properly. It is a nice idea, something that checks your post to ensure that it is compliant.

Viewing 15 replies - 1 through 15 (of 17 total)
  • Well, there is of course the “WordPress should correct invalidly nested XHTML automatically” option, but I don’t see the point wanting such a plugin. Why not just validate your blog after posting a new post, and correct if there are errors?

    <i>Well, there is of course the “WordPress should correct invalidly nested XHTML automatically” option</i>
    This may sound silly, but: Where is this option available?

    It’s on the Options|Writing page under Formatting. But it doesn’t always work that well.
    Can Tidy run on a whole WordPress page? I would think not, but that’s an interesting question. A whole-page filter. Does WP output-buffer the whole page? Sorry… I’m develo-rambling.

    Thanks, ringmaster. Found it. And, it’s actually enabled (checked). But, when I run the XHTML validator, it comes up with lots of errors. Also, someone who runs FireFox wrote to me and said that my blog is just ‘broken’ in his browser. It looks fine on IE and Netscape, though, so… I’m not sure how to fix this as I don’t have FireFox and I’m not that familiar with it either.

    Well… here we go:
    The img tag for your site heading needs an alt=”” attribute to validate.
    The text just under your heading incorrectly nests an i and a b tag (bad, like this: <i><b>text</i></b>).
    Apart from that, it seems that the method you’re using for putting your painting into WordPress, it’s generating bad XHTML. Some of the errors are weird, but that looks like what’s going on. It looks like you’re using PictPress. Something should be done about that.
    In spite of all that, the site looks just fine to me under FireFox 0.8.

    Thanks, ringmaster. Yes, I’ve been learning a few things lately…
    First, I thought I do have an alt attribute. So, not sure how to fix this.
    Yes, I realise there’s something wrong with that coding text in the heading. I tried to fix it, but I know I need to fix it some more. :p
    I’m using PictPress, and yes, it was messing some stuff up. But, I fixed some parts of the code as well. But, it looks like there are lots more to be done. :p

    Oh, and yes, I finally gave in and downloaded FireFox (great move, I think – I’m liking it). And, thank goodness it doesn’t look as bad as I thought. Thanks again!

    The problem is laziness. If I have WP set to run HTML Tidy before I post, I may correct errors that otherwise I will overlook and only discover if I validate the site or feed or if someone notices something is awry.

    PHP has a HTML Tidy module. I have been playing around with it since there has been some frustration as of late because of commenting throwing off validation. A quick glance at the QuickRef of Tidy will show that there is a wealth of features. Basically tidy will take invalid tag soup and give you some valid XHTML (if you ask nicely of course). Implementing this in PHP Is not rocket science. The biggest problem is that this module is not compiled in by default.
    The only validation issue that remains is that Tidy will not strip things according to the doctype. This kind of stuff would be fairly trivial to implement in XSLT.
    The big question is whether there is interest in this type of thing? I don’t know how WordPress handles the tag stripping and validation currently, as I do not have it installed myself. Let me know if there would be interest in this type of a plug-in.

    I’d like to see Tidy working with WordPress, my current weblog software (home-grown) uses it. As soon as I create a new post it runs through Tidy to check for errors… It’s a great feature, IMHO…

    Mark (podz)


    Support Maven

    This might be a daft question:
    When I coded my own blog (html / css) I did, at one point use Tidy or something similar. Then I found that it was bulking my code up by a significant % so I dumped it. Since then, I hardly use tabs.
    I know it’s important / accepted that code is properly indented, but for an average user, why ?

    I have written a html tidy plugin for wordpress 1.5, it works for me, cleaning my typos and the commentors’ ones 😉
    I actually really need that, since I serve pages as application/xhtml+xml, and a typo could stop the whole page from displaying in Firefox, which holds more than 2/3 of my page hits.

    That’s really a great plugin, but doesn’t seem to work for me. Do I need php5? I’ve got apache2, php4, php_tidy.dll seems to be installed. I get these 2 errors:

    [24-May-2005 12:45:51] PHP Warning: Cannot modify header information – headers already sent by (output started at C:\apache2triad\htdocs\wordpress\wp-content\plugins\wptidy.php:59) in C:\apache2triad\htdocs\wordpress\wp-admin\admin.php on line 13

    [24-May-2005 12:45:51] PHP Fatal error: Cannot instantiate non-existent class: tidy in C:\apache2triad\htdocs\wordpress\wp-content\plugins\wptidy.php on line 43

    The comments on your site don’t seem to work either.

    the comments work, I have just tested the system… as for the plugin, check for spaces/newlines at the end of the php file, there should be none (otherwise, the headers can’t be sent).
    If the php file is ok, then you may need to check if tidy really works (i.e., is the extension really loaded?), try this php code (taken from the php documentation, save it as a php file):
    $html = '<HTML><HEAD></HEAD><BODY>Hello World</BODY></HTML>';
    $config = array('indent'=> TRUE, 'output-xhtml' => TRUE, 'wrap' => 80);
    foreach ($config as $key => $value) {
    echo tidy_get_output();

    Resultant HTML should be similar to:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    <html xmlns="">
    Hello World

    if this works, then let me know, it would mean that there is something wrong with my code (the class version may not work with php 4, but I doubt that) and I’ll change it.

    The problem with the headers was indeed a single space behind the end tag of the php-section. So that error disappeared, many thanks for that.

    Php still complains about the class (with the plugin and the code posted by you here) (I tried my local sever and two other hosts). So it’s likely that tidy isn’t properly installed at none of them, as you stated above.

    For my locahost (apache, WinXP) I will have to sort it out myself. For the other hosts I ‘ll try to have my hosting’company’ installing Tidy. But wich version of tidy do they need to install? Is it available as a pear-package? Where can I find it?

    the error:

    [Fri May 27 13:52:18 2005] [error] PHP Fatal error: Call to undefined function: tidy_set_encoding() in / on line 4

    I tried twice to post a comment on your website ( a few days ago. Nothing happened, so I posted my questions here. Now I tried again (sorry for the useless comment) and I had no problems commenting. Stange things happens.

    So it seems there was nothing with your code, thanks a lot for this lovely plugin and your help.


Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘HTML Tidy’ is closed to new replies.