fix: support interpolation in MDSVEX link and image destinations #45
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
repos/svelte-sublime!45
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/mdsvex-link-destination-interpolation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Svelte interpolations in markdown link/image destinations —
[text](/path/{slug})— were left under plain markdown URL scopes (found during the adversarial review of #41;{label}in the description worked,{slug}in the URL did not).Fix: one override of Markdown's
link-url-commoncontext, which is included by every destination form (unquoted and angle-bracketed, links and images) and is identical across default packages v4143 through master.Leak guard: the interpolation rule only fires when the brace provably closes before the destination can end (whitespace,
),>). Without this, a literal unmatched{— valid in a CommonMark destination — would start an interpolation that never closes and corrupt highlighting for the rest of the document. Trade-off: interpolations containing spaces or)/>(e.g.{fn(a, b)}) fall back to plain URL highlighting rather than risking a leak.Inside the interpolation,
markup.underline.linkis cleared by the Svelte package's existingclear_scopesdesign, matching interpolation behavior in HTML attribute strings.Regression tests cover the happy path and unmatched braces in both destination forms, with following-line sentinels. Validated locally against ST 4143 and 4207.