MCPcopy Index your code
hub / github.com/Python-Markdown/markdown / _escape_cdata

Function _escape_cdata

markdown/serializers.py:64–79  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

62
63
64def _escape_cdata(text) -> str:
65 # escape character data
66 try:
67 # it's worth avoiding do-nothing calls for strings that are
68 # shorter than 500 character, or so. assume that's, by far,
69 # the most common case in most applications.
70 if "&" in text:
71 # Only replace & when not part of an entity
72 text = RE_AMP.sub('&', text)
73 if "<" in text:
74 text = text.replace("<", "&lt;")
75 if ">" in text:
76 text = text.replace(">", "&gt;")
77 return text
78 except (TypeError, AttributeError): # pragma: no cover
79 _raise_serialization_error(text)
80
81
82def _escape_attrib(text: str) -> str:

Callers 1

_serialize_htmlFunction · 0.85

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…