Skip to main content

escape_text

Function escape_text 

Source
pub fn escape_text<'a, S: Into<Cow<'a, str>>>(input: S) -> Cow<'a, str>
Expand description

Escape a string used in a text node, i.e. regular text.

Do not use this in attributes.

use htmlize::escape_text;

assert!(
    escape_text("test: &<>\"'é×😀") == "test: &amp;&lt;&gt;\"'é×😀"
);

To work with bytes ([u8]) instead of strings, see escape_text_bytes().