Function htmlize::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_eq!(
escape_text(r#"Björk & Борис O'Brien <3, "love > hate""#),
r#"Björk & Борис O'Brien <3, "love > hate""#
);
To work with bytes ([u8]
) instead of strings, see
escape_text_bytes()
.