The htmLawed module enables the use of the htmLawed (X)HTML filter/purifier with text/input formats.
Two versions of the module are available. Unlike version 3, version 2 (available for Drupal 5 and 6) allows the use of different htmLawed filter-settings for teasers (including RSS newsfeed items), as well as comments and other types of input. It also provides an option to filter submitted content before it is stored in the database, and can be configured to use different settings for different content-types (node-types). In version 3, the latter functionality is missing since it is built in Drupal 7, and can be achieved using the Better Formats module in Drupal 6. The Sanitizable (formatted text) module can be used to filter submitted content before it is stored in the database in Drupal 7.
By appropriately setting the module, Drupal administrators who are PHP coders can further finely specify the htmLawed configuration (e.g., for user-specific settings). See the handbook for more on the module.
Its speed and high configurability as well as its coverage of entire HTML (including elements like script, form and embed, CDATA sections, HTML comments, etc.) sets htmLawed apart from the in-built Drupal HTML filter as well as many other filters that require external applications like HTML Tidy or use incomplete, or large and resource-intensive libraries like HTMLPurifier.
The highly-customizable htmLawed filter can be used to make text with HTML more secure, and HTML standards- and admin. policy-compliant. It can auto-correct and beautify HTML markup and restrict HTML elements (tags), attributes, and URL protocols in the input. It also balances tags and checks for proper nesting of the HTML elements. Furthermore, it can transform deprecated tags and attributes, check and convert character entities (e.g., from hexadecimal to decimal type), obfuscate email addresses as an anti-spam measure, etc. htmLawed is an LGPL licensed, single-file (<50 Kb) script with a basal peak memory usage of just ~0.5 Mb, and is well-documented. It can be tested on this demo page.
The htmLawed.php file distributed with the module may not be up-to-date. Admins can look for a newer version of htmLawed on its website to replace the file.