MCPcopy Create free account
hub / github.com/Python-Markdown/markdown / code_escape

Function code_escape

markdown/util.py:158–166  ·  view source on GitHub ↗

HTML escape a string of code.

(text: str)

Source from the content-addressed store, hash-verified

156
157
158def code_escape(text: str) -> str:
159 """HTML escape a string of code."""
160 if "&" in text:
161 text = text.replace("&", "&")
162 if "<" in text:
163 text = text.replace("<", "&lt;")
164 if ">" in text:
165 text = text.replace(">", "&gt;")
166 return text
167
168
169def _get_stack_depth(size: int = 2) -> int:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected