MCPcopy Create free account
hub / github.com/executablebooks/markdown-it-py / html_inline

Function html_inline

markdown_it/rules_inline/html_inline.py:13–43  ·  view source on GitHub ↗
(state: StateInline, silent: bool)

Source from the content-addressed store, hash-verified

11
12
13def 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

Callers

nothing calls this directly

Calls 4

isLetterFunction · 0.85
isLinkOpenFunction · 0.85
isLinkCloseFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…