Skip to main content

Module html

Module html 

Source
Available on crate feature rich-text-editor only.
Expand description

A document to and from a small, safe subset of HTML.

to_html writes div lines, ul, ol and blockquote blocks, and strong, em, u, s, a and sized span elements, which mail clients show as they are. from_html reads that back, and also reads what other editors write closely enough to keep the formatting: p, br, headings, b, i, font sizes and inline styles. Scripts, styles, images and every attribute except a safe href are dropped.

Functionsยง

escape
Escapes text for HTML, attribute values included.
from_html
Reads HTML into a document. Unknown elements keep their text, and nested lists are flattened.
to_html
The document as an HTML fragment. Spaces are kept as typed.
to_html_document
A complete HTML document around to_html, for a mail body.