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

Function _escape_attrib_html

markdown/serializers.py:101–115  ·  view source on GitHub ↗
(text: str)

Source from the content-addressed store, hash-verified

99
100
101def _escape_attrib_html(text: str) -> str:
102 # escape attribute value
103 try:
104 if "&" in text:
105 # Only replace & when not part of an entity
106 text = RE_AMP.sub('&', text)
107 if "<" in text:
108 text = text.replace("<", "&lt;")
109 if ">" in text:
110 text = text.replace(">", "&gt;")
111 if "\"" in text:
112 text = text.replace("\"", "&quot;")
113 return text
114 except (TypeError, AttributeError): # pragma: no cover
115 _raise_serialization_error(text)
116
117
118def _serialize_html(write: Callable[[str], None], elem: Element, format: Literal["html", "xhtml"]) -> None:

Callers 2

_serialize_htmlFunction · 0.85
runMethod · 0.85

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…