Skip to content

feat: embed local Markdown image references as data URIs during indexing#525

Open
xiongjnu wants to merge 1 commit into
HKUDS:mainfrom
xiongjnu:feat/markdown-image-embedding
Open

feat: embed local Markdown image references as data URIs during indexing#525
xiongjnu wants to merge 1 commit into
HKUDS:mainfrom
xiongjnu:feat/markdown-image-embedding

Conversation

@xiongjnu

Copy link
Copy Markdown
Contributor

When a Markdown document references local images (e.g. ![](diagram.png)), resolve them relative to the markdown file and inline as base64 data URIs before passing the document to the embedding pipeline. This ensures images packaged in a zip upload survive the extraction and indexing step without broken links.

External URLs and data URIs are left untouched. Images exceeding 500 KB are skipped to keep the index size reasonable.

This is a companion to PR #522 (zip upload support) — without image inlining, markdown files extracted from a zip archive would have broken local image references.

Test plan

  • Index a .md file with ![](image.png) referencing a local image → image is inlined as data URI in the document text
  • Index a .md file with external URLs ![](https://...) → left untouched
  • Index a .md file referencing a non-existent image → kept as-is
  • Index a .md file referencing an image >500 KB → skipped, kept as-is

When a Markdown document references local images (e.g. ![](diagram.png)),
resolve them relative to the markdown file and inline as base64 data URIs
before passing the document to the embedding pipeline. This ensures images
packaged in a zip upload survive the extraction and indexing step without
broken links.

External URLs and data URIs are left untouched. Images exceeding 500 KB
are skipped to keep the index size reasonable.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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