Skip to main content

clean

Function clean 

Source
pub fn clean(html: &str) -> String
Expand description

html keeping only what some Tool produces, or "" when it holds no text: HTML a page may render unescaped, as a RichTextColumn does.

use tablo_core::rich_text::clean;

assert_eq!(
    clean(r#"<p onclick="steal()">Hi <script>alert(1)</script><b>there</b></p>"#),
    "<p>Hi there</p>",
);

A rich text field stores its value cleaned already, with its own toolbar’s tools; cleaning again keeps a value the column’s other writers stored to the same rules.