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

Function escape_cdata

markdown/extensions/toc.py:141–150  ·  view source on GitHub ↗

Escape character data.

(text: str)

Source from the content-addressed store, hash-verified

139
140
141def escape_cdata(text: str) -> str:
142 """ Escape character data. """
143 if "&" in text:
144 # Only replace & when not part of an entity
145 text = RE_AMP.sub('&', text)
146 if "<" in text:
147 text = text.replace("<", "&lt;")
148 if ">" in text:
149 text = text.replace(">", "&gt;")
150 return text
151
152
153def run_postprocessors(text: str, md: Markdown) -> str:

Callers 1

runMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected