Screenshot / configuring htmLawed filter in Drupal 8

The htmLawed module uses the htmLawed PHP library to restrict and purify HTML for compliance with site administrator policy and standards and for security. Use of the htmLawed library allows for highly customizable control of HTML markup. See the guide for more on the module.

Its speed and configurability as well as full HTML coverage sets htmLawed apart from the in-built Drupal HTML filter and many other filters that require external applications like HTML Tidy or use incomplete, or large and resource-intensive libraries like HTMLPurifier.

htmLawed 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 elements, attributes, and URL protocols in the input. It also balances tags and checks for proper nesting of HTML elements, transforms deprecated tags and attributes, checks and converts character entities, obfuscates email addresses as an anti-spam measure, etc. htmLawed is a GPL 3/LGPL 2+ licensed, single-file script with a peak memory usage of just ~1 Mb, and is well-documented. You can test htmLawed on this demo site.

The htmLawed library distributed with the module may not be up-to-date. Admins can look for a newer version of htmLawed on its website.

Project information

Releases