Skip to main content

truncate_html

Function truncate_html 

Source
pub fn truncate_html(html: &str, max_len: usize) -> Cow<'_, str>
Expand description

At most max_len bytes of an HTML document, carriage returns removed. A longer document is cut before a tag rather than inside one and, when max_len is 7 or more, ends with .... Borrowed when the document fits and has no carriage return.