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

Method __init__

markdown/inlinepatterns.py:292–307  ·  view source on GitHub ↗

Create an instant of an inline processor. Arguments: pattern: A regular expression that matches a pattern. md: An optional pointer to the instance of `markdown.Markdown` and is available as `self.md` on the class instance.

(self, pattern: str, md: Markdown | None = None)

Source from the content-addressed store, hash-verified

290 """
291
292 def __init__(self, pattern: str, md: Markdown | None = None):
293 """
294 Create an instant of an inline processor.
295
296 Arguments:
297 pattern: A regular expression that matches a pattern.
298 md: An optional pointer to the instance of `markdown.Markdown` and is available as
299 `self.md` on the class instance.
300
301 """
302 self.pattern = pattern
303 self.compiled_re = re.compile(pattern, re.DOTALL | re.UNICODE)
304
305 # API for Markdown to pass `safe_mode` into instance
306 self.safe_mode = False
307 self.md = md
308
309 def handleMatch(self, m: re.Match[str], data: str) -> tuple[etree.Element | str | None, int | None, int | None]:
310 """Return a ElementTree element from the given match and the

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected