Repository navigation
Zed extension: inline local images as data: URIs before export - #2
Merged
lecstor merged 4 commits intoOct 2, 2026
Merged
Conversation
Port the VS Code plugin's inlineLocalImages into the sidecar: Export to PDF now reads images referenced by local relative or absolute path and embeds them as data: URIs, since the service cannot reach the user's filesystem. Remote/data:/file: and protocol-relative URLs, unknown extensions and code-block text are left alone; unreadable files and files over the server's 5MB image limit are left as references and named in one non-fatal warning. Validate accessibility does not inline.
The stdio LSP integration test now exports a document referencing a local image and a missing one, asserting the render body carries the data: URI while the validate body keeps the plain reference, and that the missing image produces a non-fatal warning. README's v1 limitation is replaced by the embedding behavior and the privacy line states that referenced image bytes are sent with an export; CHANGELOG updated.
The VS Code regexes ported in 14d8046 backtrack quadratically on runs of unterminated image references: measured ~3s for 64KB of `; - require an attribute-name boundary for <img src=, so data-src="local.png" src=... no longer embeds the wrong attribute and leaves the real src local. Differential evidence: 400/400 generated structured documents and 400/400 random structural-char documents produce byte-identical output to the regex implementation, and 3x ~1-1.4MB pathological inputs scan in ~100ms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Ports the VS Code plugin's local-image inlining into the Zed sidecar.
Export to PDFnow rewrites/<img src="diagram.png">intodata:URIs before posting, so images referenced by relative or absolute paths appear in the PDF;Validate accessibilitystill posts the Markdown verbatim. Unreadable files and files over the server's 5MB per-image cap are left as references and named in one non-fatal warning. README's "local images are not embedded" limitation is replaced with the new contract and the privacy line now says the bytes of referenced local images are sent with the export.Phase-2 review fixes (commit
8cd7730).data:URI while the validate body still carriesdiagram.png.