Support xlinkHref attribute for SVG image elements#724
Draft
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: shuding <3676859+shuding@users.noreply.github.com>
Co-authored-by: shuding <3676859+shuding@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix interpretation of xlinkHref for image source in SVGs
Support xlinkHref attribute for SVG image elements
Feb 7, 2026
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.
SVG
<image>elements only recognizedhrefas the image source attribute, causing errors when using the JSX/React-compatiblexlinkHrefprop.Changes
src/handler/preprocess.ts
hrefandxlinkHrefwhen resolving image data from cacheprops.hrefandprops.xlinkHrefduring preprocessingtest/image.test.tsx
xlinkHrefattribute includingxmlns:xlinknamespace declarationThe existing
ATTRIBUTE_MAPPINGalready handles thexlinkHref→xlink:hrefconversion for SVG output.Original prompt
This section details on the original issue you should resolve
<issue_title>
xlinkHrefisn't interpreted as source for<image />in SVGs</issue_title><issue_description># Bug report
Description / Observed Behavior
Using namespaced attribute in JSX form like
xlinkHrefinstead ofxlink:hrefcauses error "Image source is not provided" to be thrown.Expected Behavior
Satori should use the JSX/TSX attribute
xlinkHrefas the<image />source, interpreting it the same it doesxlink:hrefandhref.Reproduction
Using
xlink:href(works)[Using
xlinkHref(doesn't work)](https://og-playground.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gupQfiJlzDgEmXVZ1UPtMZtf2AOGaPF8Yxlh21jqA9ma30OWoUC_glswzJR2pyNGF2UJWTG5AVuk6sWkOKVig7AXYddU9PGSgXYKpRVaaBNvQG1OVlyIA7Y2SbHCzlBdHVcSzON3fQZmonVITxFMiZ13eEYp5oS5_QAPzFJdChW9oaqJhx7ILNoPTIxpAf1aG--wQIasnsOi6KKVKEYhLHCvDHETSm6xI4nFGFsKw2GVnCPdHulIDkWn2rJJjIiESVzVPa5Q9k_mlHGE9U2tqmJKCVzMlZBbzo-7FVB0YdDj0kOa2Zv5Iy50IJFjroBvrFzwZsS5TDZjCBsKlM9GR7PY2sI7U9TTphA5gzPQjVfkIs4NTeZE9vIuKYgmOiTqi8jhbCQguUJhzJRywjbINAab5bD7dKy5-Z6VoqlloXISNqRGjOUgmKQEGsGUVM2jVZqfsr285wzhFm6WauJp_M...xlinkHrefisn't interpreted as source for<image />in SVGs #722💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.