pub fn escape(output: &mut dyn Write, buffer: &[u8]) -> Result<()>
Expand description
Writes buffer to output, escaping anything that could be interpreted as an HTML tag.
Namely:
- U+0022 QUOTATION MARK “ is rendered as "
- U+0026 AMPERSAND & is rendered as &
- U+003C LESS-THAN SIGN < is rendered as <
- U+003E GREATER-THAN SIGN > is rendered as >
- Everything else is passed through unchanged.
Note that this is appropriate and sufficient for free text, but not for URLs in attributes. See escape_href.