MCPcopy
hub / github.com/yeasy/docker_practice / parse_markdown_target

Function parse_markdown_target

check_project_rules.py:107–131  ·  view source on GitHub ↗
(body: str, start: int)

Source from the content-addressed store, hash-verified

105
106
107def parse_markdown_target(body: str, start: int) -> tuple[str, int]:
108 i = start
109 while i < len(body) and body[i].isspace():
110 i += 1
111 if i >= len(body):
112 return "", i
113 if body[i] == "<":
114 end = body.find(">", i + 1)
115 if end == -1:
116 return "", i + 1
117 return body[i + 1 : end].strip(), end + 1
118
119 target: list[str] = []
120 depth = 0
121 while i < len(body):
122 char = body[i]
123 if depth == 0 and (char.isspace() or char == ")"):
124 break
125 if char == "(":
126 depth += 1
127 elif char == ")":
128 depth -= 1
129 target.append(char)
130 i += 1
131 return "".join(target).strip(), i
132
133
134def iter_markdown_link_targets(body: str):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected