TidyText - Plugin for Moveable Type


A text-formatting plugin that uses HTML Tidy to make valid XHTML and HTML for blog entries in Moveable Type.


Moveable Type 2.6 or higher

HTML Tidy ( available at )


Get and install HTML Tidy from if you haven't already. If you don't know which version to get try Linux/x86 first.

Open in a text editor and set $TIDY to the location of Tidy, $TIDYARGS to the arguments to give Tidy ( documented at ) and $TIDYTMP to the temp directory to use.

Put in the plugins directory for your Moveable Type installation and make sure that the permissions make it readable by the web server


When you create or edit a blog entry you will have two new options under Text Formatting:

HTML Tidy (and Convert Line Breaks)

This will turn your blog entry into valid XHTML or HTML, enclose paragraphs in <p> and </p> tags and convert line breaks to <br /> tags. This is similar to the Moveable Type Text Formatting "Convert Line Breaks."


This will turn your blog entry into valid XHTML or HTML. This is similar to the Moveable Type Text Formatting "None."

Or you can use TidyText in your template as a global filter or a container tag:

Global Filter

<$MTEntryBody tidy="1"$>

Container Tag



Version 0.4

Now works as a global filter: <$MTEntryBody tidy="1"$> ( Credit: L.M. Orchard )

Also works as a container tag: <MTTidy><$MTEntryBody$></MTTidy> ( Credit: L.M. Orchard )

Checks to see if Tidy exists before filtering your output.

Version 0.3

Initial release, of course. Why would an initial release start at 0.1 or even 1.0, perish the thought!


Uses temp files for processing, which is slow, but avoids deadlock issues that IPC::Open2 can have.

Hasn't been extensively tested, use at your own risk.

Convert Line Breaks uses Moveable Type to add <p> and <br /> tags. Because this is applied to the outside of multi-line container tags (i.e. <blockquote> or <ins>) Tidy sees the nesting error and closes the container tag at the first </p>. The solution is to turn off Convert Line Breaks and put <p> and </p> around your paragraphs for entries that use this tag.


This program is copyright 2004 George Hotelling ( and licensed under the GPL.