[][src]Function marked::filter::text_normalize

pub fn text_normalize(pos: NodeRef, data: &mut NodeData) -> Action

Normalize text nodes by merging, replacing control characters and minimizing whitespace.

The filter is aware of whitespace significance rules in HTML <pre> (or similar tag) blocks as well as block vs inline elements in general. It assumes, without knowledge of any potential unconventional external styling, that leading and trailing whitespace may be removed at block element boundaries.

Because this filter works on text nodes, results are better if applied in its own Document::filter pass, depth first, and after any pass containing filters that detach or fold elements, such as detach_banned_elements or fold_empty_inline. Otherwise the filter may not be able to merge text node's which become siblings too late in the process, resulting in additional unnecessary whitespace.