Skip to main content

encode_style_double_quoted_text

Function encode_style_double_quoted_text 

Source
pub fn encode_style_double_quoted_text<S: ?Sized + AsRef<str>>(
    text: &S,
) -> Cow<'_, str>
Expand description

Encode raw text for a double-quoted CSS string inside <style>.

The input is raw text; existing escapes are encoded as text. The output is string content and does not include outer quotes. Backslashes and " are escaped with a backslash. < and C0 controls other than NUL use two uppercase hex digits and one ending space, such as \3C . NUL is replaced with U+FFFD, so text containing NUL cannot round-trip without a change. The ending space is part of the escape; an input space after it is kept. Use the output in a CSS string inside <style>, not in a CSS identifier or an HTML attribute.