MCPcopy Create free account
hub / github.com/DevCloudNinjas/DevOps-Projects / replace_image

Function replace_image

tools/build_starlight_content.py:477–487  ·  view source on GitHub ↗
(match: re.Match[str])

Source from the content-addressed store, hash-verified

475 text = normalize_code_fence_languages(text)
476
477 def replace_image(match: re.Match[str]) -> str:
478 alt, raw_target = match.group(1), match.group(2)
479 target, title = split_markdown_destination(raw_target)
480 target = normalize_external_image_url(target)
481 if is_external_or_anchor(target):
482 if target.startswith("#"):
483 return f"![{alt}]({target}{title})"
484 return external_image_reference(alt, target)
485 source_path, _ = repo_source_path(project_dir, target)
486 raw_path = quote(source_path, safe="/:@")
487 return f"![{alt}]({GITHUB_RAW}/{raw_path}{title})"
488
489 def replace_link(match: re.Match[str]) -> str:
490 label, raw_target = match.group(1), match.group(2)

Callers

nothing calls this directly

Calls 5

is_external_or_anchorFunction · 0.85
external_image_referenceFunction · 0.85
repo_source_pathFunction · 0.85

Tested by

no test coverage detected