Skip to main content

from_text

Function from_text 

Source
pub fn from_text(text: &str) -> String
Expand description

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.

use tablo_core::rich_text::from_text;

assert_eq!(
    from_text("Use Vec<String>.\nOr not.\n\nThe end"),
    "<p>Use Vec&lt;String&gt;.<br>Or not.</p><p>The end</p>"
);