Skip to content
Zotonic
  • Start
  • Cookbook
  • Reference
  • Releases

Live search

Search across all Zotonic content

Type at least two characters

Results are matched against titles, summaries and topics as you type.

Filters · mod_base
  • Reference
  • Frontend developer
  • Template filter
  • HTML
  • Security

sanitize_html

Module

mod_base

Sanitize a HTML code. Removes elements and attributes that might be dangerous, like <script> elements.

This filter parses the complete HTML string and ensures that the output is safe and valid HTML.

Do not use (without caching) on busy pages, as the sanitization process is cpu and memory intensive.

Edit on GitHub

Related documentation

Filters

escape

HTML escape a text. Escapes all reserved HTML characters in the value. Escaped strings are safe to be displayed in a HTML page. When you…

Filters

escape_check

Ensures thant an HTML escaped value is properly escaped.

Filters

striptags

Removes all HTML tags from the value.

Filters

escape_link

Convert any URLs in a plaintext into HTML links, with adding the rel="nofollow" attribute, and replaces all newlines with <br> tags.

Filters

force_escape

HTML escapes a text.

Filters

unescape

Removes HTML escaping from a text.

Filters

render

Render a template.

Filters

format_dispatch_path_element

Format dispatch path element so variables will be more visible.

Filters

format_dispatch_controller_option

Format dispatch controller options.

GitHub © 2026 Zotonic