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

Method parse_html_declaration

markdown/htmlparser.py:380–394  ·  view source on GitHub ↗
(self, i: int)

Source from the content-addressed store, hash-verified

378 return match.end()
379
380 def parse_html_declaration(self, i: int) -> int:
381 if self.at_line_start() or self.intail:
382 if self.rawdata[i:i+3] == '<![' and not self.rawdata[i:i+9] == '<![CDATA[':
383 # We have encountered the bug in #1534 (Python bug `gh-77057`).
384 # Provide an override until we drop support for Python < 3.13.
385 result = self.parse_bogus_comment(i)
386 if result == -1:
387 self.handle_data(self.rawdata[i:i + 1])
388 return i + 1
389 return result
390 return super().parse_html_declaration(i)
391 # This is not the beginning of a raw block so treat as plain data
392 # and avoid consuming any tags which may follow (see #1066).
393 self.handle_data('<!')
394 return i + 2
395
396 def parse_bogus_comment(self, i: int, report: int = 0) -> int:
397 # Override the default behavior so that bogus comments get passed

Callers

nothing calls this directly

Calls 3

at_line_startMethod · 0.95
parse_bogus_commentMethod · 0.95
handle_dataMethod · 0.95

Tested by

no test coverage detected