Skip to main content

Module rich_text

Module rich_text 

Source
Expand description

Rich text (ADR-0032): the Tools a toolbar offers, the HTML each produces, and the cleaning that keeps a value to the elements its tools produce. A rich text field cleans what it reads and RichTextColumn what it renders; a page of the app’s own renders a stored value through clean.

Rich text sits behind the rich-text feature, on by default. An app that turns the default features off and leaves it out has no rich text field, column or module, and builds without ammonia and its HTML parser.

Functions§

clean
html keeping only what some Tool produces, or "" when it holds no text: HTML a page may render unescaped, as a RichTextColumn does.
from_text
A rich text document showing text: a paragraph for each run of lines between blank lines, a line break for each single newline, and &, < and > escaped. It moves a plain text column to rich text, whose fields read their stored value as HTML.
text
The text a reader sees in html, with a line break after each block: a summary, a search index or a word count.