MCPcopy
hub / github.com/mkdocs/mkdocs / _RawHTMLPreprocessor

Class _RawHTMLPreprocessor

mkdocs/structure/pages.py:522–537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

520
521
522class _RawHTMLPreprocessor(markdown.preprocessors.Preprocessor):
523 def __init__(self) -> None:
524 super().__init__()
525 self.present_anchor_ids: set[str] = set()
526
527 def run(self, lines: list[str]) -> list[str]:
528 parser = _HTMLHandler()
529 parser.feed('\n'.join(lines))
530 parser.close()
531 self.present_anchor_ids = parser.present_anchor_ids
532 return lines
533
534 def _register(self, md: markdown.Markdown) -> None:
535 md.preprocessors.register(
536 self, "mkdocs_raw_html", priority=21 # Right before 'html_block'.
537 )
538
539
540class _HTMLHandler(markdown.htmlparser.htmlparser.HTMLParser): # type: ignore[name-defined]

Callers 1

renderMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…