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

Method unescape

markdown/inlinepatterns.py:235–251  ·  view source on GitHub ↗

Return unescaped text given text with an inline placeholder.

(self, text: str)

Source from the content-addressed store, hash-verified

233 return self.__class__.__name__
234
235 def unescape(self, text: str) -> str:
236 """ Return unescaped text given text with an inline placeholder. """
237 try:
238 stash = self.md.treeprocessors['inline'].stashed_nodes
239 except KeyError: # pragma: no cover
240 return text
241
242 def get_stash(m):
243 id = m.group(1)
244 if id in stash:
245 value = stash.get(id)
246 if isinstance(value, str):
247 return value
248 else:
249 # An `etree` Element - return text content only
250 return ''.join(value.itertext())
251 return util.INLINE_PLACEHOLDER_RE.sub(get_stash, text)
252
253
254class InlineProcessor(Pattern):

Callers 9

closeMethod · 0.45
parse_starttagMethod · 0.45
getLinkMethod · 0.45
handleMatchMethod · 0.45
makeTagMethod · 0.45
handleMatchMethod · 0.45
handleMatchMethod · 0.45
get_nameFunction · 0.45
runMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected