Textpattern Plugin: lmd_cleanup

The "lmd_cleanup" plugin for Textpattern removes extraneous line-breaks left behind in pages by the Textpattern tags used in the Page/Form templates that make-up the displayed page. Especially useful if you use a lot of conditional tags in your templates, where each line of Textpattern code inserts a line-break in the resulting page

Download: lmd_cleanup [ver. 0.2.1] [size: 5.94kB] / 130 downloads.


  1. Download the file above and save it to your computer.
  2. Open it and copy/paste the compressed code into your Textpattern plugin uploader.
  3. Don't forget to enable the plugin!

Add a single tag at the very top of any templates containing the <html> tag (before the <!DOCTYPE ...> if there is one).

You can optionally specify certain tags for the plugin to ignore if you want their white-space/line-breaks to remain untouched (e.g. <pre>).

Also optionally strips HTML comments (<!-- [...] -->), enabling you to liberally comment your templates without them being visible in the page source or adding to the document size/load overhead.

lmd_cleanup Demo
Getting rid of those acres of white-space. (Click on image to 'embiggen')

Important Notice

31st July 2012: I think this issue is now fixed. Please upgrade to the latest version (ver. 0.2.1) of the plugin. I advise you to double-check your file downloads as a precaution, however.

[The the following notice only applies to plugin versions < 0.2.1]

If you are using the Textpattern's file download facility on your own site, then you may encounter problems downloading files while this plugin is installed.

The plugin modifies the output buffer, which causes errors with downloading certain file-types. Furthermore, the errors only appear to manifest in certain operating system (Win 7 is affected, but Win XP is fine for some reaon)

Until such time as I figure out how to avoid this, please proceed with caution if you are using file downloads. Thoroughly check all files and if any develop problems, you might need to disable the plugin.


This code is based on aks_header by makss, but very much simplified. I just wanted something to remove the acres of extra new-lines, not to scrunch everything up on to one line or compress it.

If you want more than just white-space/line-break stripping, then I recommend aks_header.


Version 0.2.1
  • Fixed bug when using Textpattern's File Download facility.
Version 0.2
  • Added optional html comment stripping.
Version 0.1
  • First release

Comments (0)

There are no comments yet - be the first to add one!

Add Your Comment
Get a Gravatar
(Not displayed)
HTML not allowed, please use Textile for formatting (Textile help).