(state: StateInline, silent: bool)
| 11 | |
| 12 | |
| 13 | def html_inline(state: StateInline, silent: bool) -> bool: |
| 14 | pos = state.pos |
| 15 | |
| 16 | if not state.md.options.get("html", None): |
| 17 | return False |
| 18 | |
| 19 | # Check start |
| 20 | maximum = state.posMax |
| 21 | if state.src[pos] != "<" or pos + 2 >= maximum: |
| 22 | return False |
| 23 | |
| 24 | # Quick fail on second char |
| 25 | ch = state.src[pos + 1] |
| 26 | if ch not in ("!", "?", "/") and not isLetter(ord(ch)): # /* / */ |
| 27 | return False |
| 28 | |
| 29 | match = HTML_TAG_RE.search(state.src[pos:]) |
| 30 | if not match: |
| 31 | return False |
| 32 | |
| 33 | if not silent: |
| 34 | token = state.push("html_inline", "", 0) |
| 35 | token.content = state.src[pos : pos + len(match.group(0))] |
| 36 | |
| 37 | if isLinkOpen(token.content): |
| 38 | state.linkLevel += 1 |
| 39 | if isLinkClose(token.content): |
| 40 | state.linkLevel -= 1 |
| 41 | |
| 42 | state.pos += len(match.group(0)) |
| 43 | return True |
nothing calls this directly
no test coverage detected
searching dependent graphs…