Text & i18n4 exports
Raw Markdown/html
HTML entity escaping, attribute sanitization, and tag stripping for safe user-generated content.
Functions & symbols#
escape#
function
Escapes HTML special characters (`&`, `<`, `>`, `"`, `'`) for safe attribute and element rendering.
| Parameter | Type | Optional | Description |
|---|---|---|---|
text | String | required | Plain string to HTML-escape |
Returns:
Any(html/escape "<b>hi</b>")escape-text#
function
Escapes `&`, `<`, and `>` characters in text nodes without escaping quotes.
| Parameter | Type | Optional | Description |
|---|---|---|---|
html | String | required | String containing HTML markup |
Returns:
Any(html/escape-text "a < b")sanitize#
function
Sanitizes untrusted HTML using an allowlist-based cleaner, stripping scripts, event handlers, and unsafe URLs.
| Parameter | Type | Optional | Description |
|---|---|---|---|
html | String | required | Untrusted HTML fragment |
Returns:
Any(html/sanitize user-bio-html)