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

Method __init__

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

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