MCPcopy Create free account
hub / github.com/executablebooks/markdown-it-py / escapeHtml

Function escapeHtml

markdown_it/common/utils.py:139–146  ·  view source on GitHub ↗

Replace special characters "&", "<", ">" and '"' to HTML-safe sequences.

(raw: str)

Source from the content-addressed store, hash-verified

137
138
139def escapeHtml(raw: str) -> str:
140 """Replace special characters "&", "<", ">" and '"&#x27; to HTML-safe sequences."""
141 # like html.escape, but without escaping single quotes
142 raw = raw.replace("&", "&amp;") # Must be done first!
143 raw = raw.replace("<", "&lt;")
144 raw = raw.replace(">", "&gt;")
145 raw = raw.replace('"', "&quot;")
146 return raw
147
148
149# //////////////////////////////////////////////////////////////////////////////

Callers 5

renderAttrsMethod · 0.85
code_inlineMethod · 0.85
code_blockMethod · 0.85
fenceMethod · 0.85
textMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…