Function pulldown_cmark_escape::escape_html_body_text
source · pub fn escape_html_body_text<W: StrWrite>(w: W, s: &str) -> Result<(), W::Error>
Expand description
For use in HTML body text, writes the given string to the Write sink, replacing special HTML bytes (<, >, &) by escape sequences.
This function should be used for escaping text nodes, not attributes.
In the below example, the word “foo” is an attribute, and the word
“bar” is an text node. The word “bar” could be escaped by this function,
but the word “foo” must be escaped using escape_html
.
<span class="foo">bar</span>
If you aren’t sure what the difference is, use escape_html
.
It should always be correct, but will produce larger output.