You are here: Home Plone Book HTML Filter

HTML filter

by Olha Pelishok last modified 2009-03-18

This article applies to Plone 2.5, Plone 2.1

The HTML filter is a tool that is used to remove specific tags embedded in documents saved as Hypertext Markup Language (HTML).

A lot of Plone users have similar questions: where does such a tag as 'font' , or such attributes as 'width' and 'height' or 'align' disappear after saving the document on a Plone site? The answer to such questions is very simple: that's how HTML filters work. When a HTML document is created somewhere outside Plone site, some specific markup tags are embedded in it. The moment such a document is placed into Plone site and is saved on it, a HTML filter removes the specific markup tags from the HTML document.

What is the reason for this? Imagine HTML filter is not quite correct, it is broken, as a result, this not valid HTML code will have a negative impact on a page-layout, and the desirable site look will not be achieved.

The whole site design may suffer from such invalid HTML code. Thus, one more reason for such filter existing is to prevent Content Managers from editing content on a Plone site with the help of different tags inappropriate for such purposes. The only possible way to edit content design is to accomplish it with various styles. That's why HTML filters also get rid of such tags as 'big', 'small' or those, denoting some colors etc.

By removing the tags, the size of the document is reduced too, which in turn reduces both the amount of space used on Web servers as well as the time it takes to download the page.

There are several HTML filters available on Plone sites. These are Kupu HTML filter, Safe HTML, and mxTidy. When they all act in unison, then the result is visible in Plone site, and it works correctly.

Kupu HTML Filter

Kupu lets you blacklist attributes on particular tags, or all occurrences of a specific attribute or a tag. To see which tags can be removed, go to Site Setup -> Kupu visual editor

. Here you can remove the ticks near selected items. When the selected ticks are removed, Kupu will not filter those tags you want to keep. You can put down special tags and attributes you want Kupu filter when document is saved.



There are several default tags and attributes that are removed, when Kupu HTML Filter is enabled.

These are the tags, that are removed by default:

    • center
    • tt
    • big
    • small
    • s
    • strike
    • basefont
    • font

The following attributes are removed from any tag:

    • dir
    • lang
    • valign
    • halign
    • border
    • frame
    • rules
    • cellspacing
    • cellpadding
    • bgcolor

The attributes width, height are removed from the tags table, th, td

What concerns Style Whitelist, text-align, list-style-type, and float are allowed to remain since Kupu can generate them under some circumstances.


MxTidy - one more useful filter, that helps to cleanup coding errors in HTML and XML files and produce well-formed HTML, XHTML or XML as output.


The Safe HTML transform is applied to the documents when they are rendered by Plone. The intention of this filter is to clean potentially bad tags.

To enable this filter, or just to cancel some default tags to be removed, you have to use Zope Management Interface. To see your site in Zope interface add /manage to the site url. In the opened window choose portal_transforms -> safe_html.



Plone allows customizing as follows:

  • disable the entire transform.
  • edit the lists of nasty tags, valid tags, and whether or not javascript is to be stripped.

Such tags are permitted by Safe HTML: a area b base big blockquote body br caption cite code dd del div dl dt em h1 h2 h3 h4 h5 h6 head hr html i img ins kbd li map meta ol p pre q small span strong sub sup table tbody td th title tr tt u ul.

To disable any tag filtering you have to delete 1 or put 0 instead of it in a value field.

Document Actions
Powered by Plone