Function html2pango::markup
source · pub fn markup(s: &str) -> String
Expand description
Sanitizes and converts simple HTML markup to Pango Markup.
This will sanitize the input string using the ammonia
crate’s defaults and then
use markup_from_raw
to convert the sanitized string to Pango Markup.
Examples
let m = markup("this is parsed");
assert_eq!(m, "this is parsed");
let m = markup("<b>this <i>is &ssd<f;</i></b>");
assert_eq!(m, "<b>this <i>is &ssd</i></b>");
let m = markup("this is <span>parsed</span>");
assert_eq!(m, "this is <span>parsed</span>");
let m = markup("with links: http://gnome.org");
assert_eq!(m, "with links: <a href=\"http://gnome.org\">http://gnome.org</a>");