Skip to main content

normalize_whitespace

Function normalize_whitespace 

Source
pub fn normalize_whitespace(text: &str, white_space: WhiteSpace) -> Cow<'_, str>
Expand description

Normalizes segment breaks and collapsible whitespace according to the element’s white-space.

Returns Cow::Borrowed when text is already in normalized form, which is the common case for the many short text nodes whose content has no segment breaks, repeated spaces or leading/trailing whitespace. Only the text that actually needs rewriting is copied.