INNER CODE UNIT · Python
local_link_target
zhinkgit/embeddedskills · .github/maintenance/repo_checks.py:100
def local_link_target(raw_target: str) -> str | None:
target = raw_target.strip()
if target.startswith("<") and ">" in target:
target = target[1:target.index(">")]
else:
target = target.split(maxsplit=1)[0]
parsed = urlsplit(target)
if parsed.scheme or parsed.netloc or not parsed.path:
return None
return unquote(parsed.path)
def check_markdown_links(root: Path) -> list[str]:
errors: list[str] = []
for path in matching_files(root, "*.md"):
text = path.read_text(encoding="utf-8")
for match in LINK_PATTERN.finditer(text):