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

Method __init__

markdown/inlinepatterns.py:263–278  ·  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

261 """
262
263 def __init__(self, pattern: str, md: Markdown | None = None):
264 """
265 Create an instant of an inline processor.
266
267 Arguments:
268 pattern: A regular expression that matches a pattern.
269 md: An optional pointer to the instance of `markdown.Markdown` and is available as
270 `self.md` on the class instance.
271
272 """
273 self.pattern = pattern
274 self.compiled_re = re.compile(pattern, re.DOTALL | re.UNICODE)
275
276 # API for Markdown to pass `safe_mode` into instance
277 self.safe_mode = False
278 self.md = md
279
280 def handleMatch(self, m: re.Match[str], data: str) -> tuple[etree.Element | str | None, int | None, int | None]:
281 """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