Keep content clean!

TextCleaner is a simple module aimed at keeping content clean of empty HTML tags.

The best example for using this module would be if you have Fields that are HTML formatted with WYSIWYGs. WYSIWYGs sometimes insert empty HTML tags that can make your content look messy.

For example, the following markup can be seen in a variety of WYSIWYG output(s) and difficult to remove for the end-user (from a WYSIWYG UI):

<p align="right"></p>


<p><br /></p>

<h2 class="title"></h2>

<h4>            </h4>

   <li>Bullet Point</li> (this is okay)
   <li></li> (this is not)

And so on and so forth. If your stylesheets define p or h tags as having margin/padding bottom to add space, this can be troublesome for the end user when viewing or editing content. They may not be savvy enough to edit the HTML directly- but they should not have to be either.

Note that this isn't something that cleans up the display rendering, but rather attempts to prevent bad markup (seen above) from reaching the database.

So far this has been tested and works well removing the tags in the above scenario (using CKEditor).

Please note that this is still in development and you should test it out first on a local/non-production site before putting into production.


Drupal 6

A Drupal 6 port is currently underway. Currently there are no plans to make it as flexible as the D7 version, but to work the best it can with nodes. If you'd like to be the maintainer of the D6 port, contact me.

Drupal 7

Drupal 7 will be the main platform this module is built for. Currently, it should handle any entities with fields defined or attached with the FieldAPI and/or FieldUI.

So far, Text, Long Text, and Long Text with Summary fields have been tested thoroughly. There would not be much reason any other field or custom field created with the FieldAPI would not work, though this should solve 99% of use cases.

Drupal 8


Project Information