Function htmlize::escape_text_bytes

source ·
pub fn escape_text_bytes<'a, S: Into<Cow<'a, [u8]>>>(input: S) -> Cow<'a, [u8]>
Expand description

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

Do not use this in attributes.

use htmlize::escape_text_bytes;

assert_eq!(
    escape_text_bytes(b"test: &<>\"'".as_slice()),
    b"test: &amp;&lt;&gt;\"'".as_slice()
);

To work with String instead of bytes, see escape_text().