Skip to content

fix: resolve dropped hrefs on inline rich-text links - #495

Merged
tristan-mouchet merged 1 commit into
developfrom
fix/rich-text-link-href
Aug 14, 2026
Merged

fix: resolve dropped hrefs on inline rich-text links#495
tristan-mouchet merged 1 commit into
developfrom
fix/rich-text-link-href

Conversation

@tristan-mouchet

Copy link
Copy Markdown
Collaborator

Summary

Inline rich-text links (e.g. authored via MCP as [text](url)) rendered without a working href, 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 through LinkSettings ({ type: 'url', url: { type: 'dynamic_text', data: { content } } }). With type/url missing, the href resolved to empty and was dropped. The editor's own markdown path already used the correct shape.

Changes

  • Emit canonical url variable attrs from the MCP inline parser (lib/mcp/utils.ts), matching the editor's markdown authoring
  • Tolerate the legacy { href, linkType } mark shape in getLinkSettingsFromMark, so already-authored links resolve at render time (both React and server-HTML paths)
  • Normalise mark attrs via getLinkSettingsFromMark on the React render path (lib/text-format-utils.ts) instead of casting raw attrs
  • Fix the sample template link to use the canonical shape (lib/templates/content.ts)

Test plan

  • Author a rich-text link via MCP [text](url) → published/preview HTML has a working href
  • Existing MCP-authored links (legacy shape) now render with an href
  • Editor-authored links (url/page/email/phone/asset/field) still resolve correctly
  • Bold/italic and other inline formatting unaffected
  • target/rel/download still applied

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 tristan-mouchet added the Bug Something isn't working label Aug 14, 2026
@tristan-mouchet tristan-mouchet self-assigned this Aug 14, 2026
@tristan-mouchet
tristan-mouchet merged commit 35cbb0c into develop Aug 14, 2026
2 of 3 checks passed
@tristan-mouchet tristan-mouchet linked an issue Aug 14, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: renderer drops hrefs from inline rich-text links

1 participant