Function html2pango::html_escape

source ·
pub fn html_escape(s: &str) -> String
Expand description

Escapes the HTML reserved characters.

This replaces the HTML reserved characters by their respective entities in the input string.

Examples

let s = html_escape("this is a <tag>");
assert_eq!(s, "this is a &lt;tag&gt;");

let s = html_escape("he says: \"this & that\"");
assert_eq!(s, "he says: &quot;this &amp; that&quot;");