fix: resolve dropped hrefs on inline rich-text links - #495
Merged
Conversation
MCP-authored [text](url) links were stored with a non-canonical mark
shape ({ href, linkType }) that the renderer's LinkSettings resolver
ignored, so the href was dropped on published/previewed pages.
- Emit canonical url variable attrs from the MCP inline parser
- Tolerate the legacy { href, linkType } shape in getLinkSettingsFromMark
so already-authored links resolve at render time
- Normalise attrs via getLinkSettingsFromMark on the React render path
- Fix the sample template link to use the canonical shape
tristan-mouchet
requested review from
liamwalder,
lunenas and
ysamcode
as code owners
August 14, 2026 07:33
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.
Summary
Inline rich-text links (e.g. authored via MCP as
[text](url)) rendered without a workinghref, so clicks did nothing on published/previewed pages. Closes #493.The root cause: the MCP inline parser stored the link mark with a non-canonical shape (
{ href, linkType }), while the renderer resolves links throughLinkSettings({ type: 'url', url: { type: 'dynamic_text', data: { content } } }). Withtype/urlmissing, the href resolved to empty and was dropped. The editor's own markdown path already used the correct shape.Changes
urlvariable attrs from the MCP inline parser (lib/mcp/utils.ts), matching the editor's markdown authoring{ href, linkType }mark shape ingetLinkSettingsFromMark, so already-authored links resolve at render time (both React and server-HTML paths)getLinkSettingsFromMarkon the React render path (lib/text-format-utils.ts) instead of casting raw attrslib/templates/content.ts)Test plan
[text](url)→ published/preview HTML has a workinghreftarget/rel/downloadstill applied