Skip to main content

Module escape

Module escape 

Source
Expand description

HTML escaping utilities.

Fast-path optimized: scans for first escapable character, then bulk-copies segments between escapes.

Functionsยง

escape_attr_into
Escape HTML attribute value into output buffer.
escape_full_into
Escape HTML text content, checking for quotes as well (for attribute context).
escape_text
Escape and return as a new Vec.
escape_text_into
Escape HTML text content into output buffer.
escape_text_to_string
Escape and return as a String.
needs_attr_escape
Check if a byte slice needs any escaping for attribute values.
needs_text_escape
Check if a byte slice needs any escaping for text content.
url_encode_then_html_escape
Characters that need percent-encoding in URLs:
url_escape_link_destination
Process a link URL: decode entities, handle backslash escapes, and percent-encode. This is used for link destinations in [text](url) syntax.