Encode HTML special characters so they roundtrip safely through markdown.
& is encoded first to avoid double-encoding the ampersand in other
entities (e.g. < → <, not &lt;).
Note: " is intentionally NOT encoded here because double quotes are
ordinary characters in markdown and do not need escaping. The decode
function still handles " because the markdown tokenizer may emit it.
Encode HTML special characters so they roundtrip safely through markdown.
&is encoded first to avoid double-encoding the ampersand in other entities (e.g.<→<, not&lt;).Note:
"is intentionally NOT encoded here because double quotes are ordinary characters in markdown and do not need escaping. The decode function still handles"because the markdown tokenizer may emit it.