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

Function code

markdown_it/rules_block/code.py:10–36  ·  view source on GitHub ↗
(state: StateBlock, startLine: int, endLine: int, silent: bool)

Source from the content-addressed store, hash-verified

8
9
10def code(state: StateBlock, startLine: int, endLine: int, silent: bool) -> bool:
11 LOGGER.debug("entering code: %s, %s, %s, %s", state, startLine, endLine, silent)
12
13 if not state.is_code_block(startLine):
14 return False
15
16 last = nextLine = startLine + 1
17
18 while nextLine < endLine:
19 if state.isEmpty(nextLine):
20 nextLine += 1
21 continue
22
23 if state.is_code_block(nextLine):
24 nextLine += 1
25 last = nextLine
26 continue
27
28 break
29
30 state.line = last
31
32 token = state.push("code_block", "code", 0)
33 token.content = state.getLines(startLine, last, 4 + state.blkIndent, False) + "\n"
34 token.map = [startLine, state.line]
35
36 return True

Callers

nothing calls this directly

Calls 4

is_code_blockMethod · 0.80
isEmptyMethod · 0.80
getLinesMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…