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

Function escapedSplit

markdown_it/rules_block/table.py:28–56  ·  view source on GitHub ↗
(string: str)

Source from the content-addressed store, hash-verified

26
27
28def escapedSplit(string: str) -> list[str]:
29 result: list[str] = []
30 pos = 0
31 max = len(string)
32 isEscaped = False
33 lastPos = 0
34 current = ""
35 ch = charStrAt(string, pos)
36
37 while pos < max:
38 if ch == "|":
39 if not isEscaped:
40 # pipe separating cells, '|'
41 result.append(current + string[lastPos:pos])
42 current = ""
43 lastPos = pos + 1
44 else:
45 # escaped pipe, '\|'
46 current += string[lastPos : pos - 1]
47 lastPos = pos
48
49 isEscaped = ch == "\\"
50 pos += 1
51
52 ch = charStrAt(string, pos)
53
54 result.append(current + string[lastPos:])
55
56 return result
57
58
59def table(state: StateBlock, startLine: int, endLine: int, silent: bool) -> bool:

Callers 1

tableFunction · 0.85

Calls 1

charStrAtFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…