Skip to content

fix: resolve SVG embeds correctly - #3

Open
puradox wants to merge 2 commits into
quartz-community:mainfrom
puradox:resolve-object-embeds
Open

fix: resolve SVG embeds correctly#3
puradox wants to merge 2 commits into
quartz-community:mainfrom
puradox:resolve-object-embeds

Conversation

@puradox

@puradox puradox commented Jul 14, 2026

Copy link
Copy Markdown

The link crawler resolves a[href] and the src of img, video, audio, and iframe, but <object> points at its resource through data rather than src — so those URLs were left untouched. This bites SVG embeds in particular: obsidian-flavored-markdown renders them as <object type="image/svg+xml"> (to keep the SVG DOM live), so ![[diagram.svg]] from a note in a subfolder ends up with an unresolved path and 404s (quartz-community/obsidian-flavored-markdown#2).

This adds an object[data] resolution pass next to the existing src handling, with a test checking that an <object data> resolves to the same URL as the equivalent <img src>.

The link resolver rewrote a[href] and img/video/audio/iframe[src] but skipped
<object data>. SVG wikilink embeds are rendered as <object type=image/svg+xml>
to keep the SVG DOM live, so their data= path was never resolved and 404'd from
notes outside the vault root. Resolve object[data] with the same transformLink
pass used for the other resources.

Fixes quartz-community/obsidian-flavored-markdown#2

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@puradox puradox changed the title fix: resolve <object data> URLs (e.g. SVG embeds) fix: resolve SVG embeds correctly Jul 14, 2026
@puradox
puradox marked this pull request as ready for review July 14, 2026 02:12
Pairs with the engine-side slugifyFilePath wrapper that collapses
hyphen runs from Obsidian-style ' - ' filenames: targets are matched
against the engine-provided legacy slug variants, then the resolved
href is collapsed (path only, anchors untouched) so links land on the
canonical page. Site-specific; gate on an option before upstreaming.

Co-Authored-By: Claude Fable 5 <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