Markup.Sanitize (Markup v0.1.0)

Copy Markdown View Source

The ammonia sanitize option schema every language shares, plus the helpers that escape braces for HEEx.

Pass sanitize: to any render function and the final HTML gets sanitized. Your options are merged over the language's default_sanitize_options/0, and nil turns sanitizing off. The option names follow ammonia's Builder; see schema/0.

Summary

Functions

Resolves option combinations that ammonia rejects. A tag listed in allowed_classes/add_allowed_classes loses class from its tag_attributes/add_tag_attributes, so the class allowlist alone decides which classes it keeps. Languages call this on Markup.Document.get_option(doc, :sanitize) before they sanitize.

The sanitize option schema. The languages supply the defaults.

Functions

prepare(kw)

@spec prepare(keyword() | nil) :: keyword() | nil

Resolves option combinations that ammonia rejects. A tag listed in allowed_classes/add_allowed_classes loses class from its tag_attributes/add_tag_attributes, so the class allowlist alone decides which classes it keeps. Languages call this on Markup.Document.get_option(doc, :sanitize) before they sanitize.

schema()

@spec schema() :: keyword()

The sanitize option schema. The languages supply the defaults.