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

Method test

markdown/blockprocessors.py:472–475  ·  view source on GitHub ↗
(self, parent: etree.Element, block: str)

Source from the content-addressed store, hash-verified

470 RE = re.compile(r'(?:^|\n)(?P<level>#{1,6})(?P<header>(?:\\.|[^\\#]|#+(?=[^#\n]))*?)#*(?:\n|$)')
471
472 def test(self, parent: etree.Element, block: str) -> bool:
473 # Check for a line starting with `#` before running the regex, which is
474 # slow to scan long blocks.
475 return (block.startswith('#') or '\n#' in block) and bool(self.RE.search(block))
476
477 def run(self, parent: etree.Element, blocks: list[str]) -> None:
478 block = blocks.pop(0)

Callers

nothing calls this directly

Calls 1

searchMethod · 0.80

Tested by

no test coverage detected