Skip to content

fix: skip reference-style images in markdown image extraction - #5

Merged
developer0hye merged 1 commit into
mainfrom
fix/reference-style-image-extraction
Mar 9, 2026
Merged

fix: skip reference-style images in markdown image extraction#5
developer0hye merged 1 commit into
mainfrom
fix/reference-style-image-extraction

Conversation

@developer0hye

Copy link
Copy Markdown
Owner

Summary

  • extract_markdown_image_destinations() incorrectly matched reference-style images ([![Badge]][ref]) with unrelated inline links ([text](url)) further in the document, because it searched for any ]( after ![ without verifying bracket pairing
  • Added find_closing_bracket() to properly locate the alt-text closing ], then checks that ( immediately follows before extracting a URL
  • Reference-style image syntax is now correctly skipped, eliminating false remote-asset extractions

This fixes the spurious corpus advisories for serde-rs/serde (https://serde.rs) and mkdocs/mkdocs (LICENSE URL).

Related: #1

Test plan

  • New test does_not_extract_reference_style_images_as_remote_assets with fixture containing both reference-style badges and inline images — verifies only inline images are extracted
  • All existing marknest-core tests pass (analyze_workspace, analyze_zip, render_workspace_html, render_zip_html)
  • Re-run 50-repo corpus validation to confirm serde-rs/serde and mkdocs/mkdocs no longer produce advisories

🤖 Generated with Claude Code

extract_markdown_image_destinations() searched for any `](` after `![`,
causing reference-style images like `[![Badge]][ref]` to false-match
with unrelated inline links further in the document. This produced
spurious remote-asset advisories for serde-rs/serde (https://serde.rs)
and mkdocs/mkdocs (LICENSE URL).

Add find_closing_bracket() to locate the actual `]` closing the alt
text, then verify `(` immediately follows before extracting the URL.
Reference-style images are now correctly skipped.

Related: #1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
@developer0hye
developer0hye merged commit d017835 into main Mar 9, 2026
2 checks passed
@developer0hye
developer0hye deleted the fix/reference-style-image-extraction branch March 9, 2026 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant