Skip to main content

Module preview

Module preview 

Source
Expand description

Previews and truncation of text and HTML bodies.

Functionsยง

preview_html
A text preview of an HTML document: crate::html_to_text of the document cut like preview_text. Only the part of the document that the preview needs is converted.
preview_text
At most max_len bytes of text, carriage returns removed. Longer text is cut at a character boundary and, when max_len is 7 or more, ends with ... (counted in max_len). Borrowed when the text fits and has no carriage return.
truncate_html
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.
truncate_text
Truncates text for display; the same as preview_text.