Function html2pango::markup
[−]
[src]
pub fn markup(s: &str) -> String
Sanitize the input using ammonia
's defaults,
Convert the input &str
to pango format and parse
URLS to show as pango
markup links(removes rel attributes).
If you want to parse a pre-sanitized input, you can use markup_from_raw
.
Currently it support conversion of the following html
tags:
<p>
and</p>
=>""
<i>
,<em>
and</i>
,</em>
=><i>
and ```<b>
,<strong>
and</b>
,</strong>
=><b>
and</b>
<br>
=>\n
- rest
<
=><
- rest
>
=>>
=>
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>");