Repository navigation
feat(embed): render markdown in the app - #4334
Draft
josemontespg wants to merge 1 commit into
Draft
josemontespg wants to merge 1 commit into
josemontespg wants to merge 1 commit into
Conversation
josemontespg
force-pushed
the
embed/5-markdown
branch
from
November 20, 2026 20:40
1359326 to
457dead
Compare
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces markdown rendering support to the A2UI embed app using @a2ui/markdown-it and @lit/context, along with a configurable option to disable it for smaller bundle sizes. It also intercepts link clicks to open them via the host's ui/open-link request instead of navigating the iframe. The review feedback highlights two key improvements: first, only calling event.preventDefault() when a link is actually openable by the host to prevent breaking default browser behaviors like anchor scrolling; second, replacing URL.canParse with a try/catch block around new URL() to maintain compatibility with older browsers.
josemontespg
force-pushed
the
embed/5-markdown
branch
from
November 20, 2026 21:12
457dead to
0edd566
Compare
josemontespg
force-pushed
the
embed/5-markdown
branch
from
November 20, 2026 21:36
0edd566 to
f152970
Compare
josemontespg
force-pushed
the
embed/5-markdown
branch
from
November 20, 2026 21:51
f152970 to
0bb1712
Compare
josemontespg
force-pushed
the
embed/5-markdown
branch
from
November 21, 2026 00:25
0bb1712 to
a629892
Compare
josemontespg
force-pushed
the
embed/5-markdown
branch
from
November 21, 2026 00:43
a629892 to
7f35117
Compare
josemontespg
force-pushed
the
embed/5-markdown
branch
from
November 21, 2026 02:34
7f35117 to
ce2ecd8
Compare
josemontespg
force-pushed
the
embed/5-markdown
branch
from
November 23, 2026 22:09
ce2ecd8 to
20d00bb
Compare
This was referenced Nov 23, 2026
Closed
josemontespg
force-pushed
the
embed/5-markdown
branch
2 times, most recently
from
November 26, 2026 01:24
4349673 to
64e0d93
Compare
josemontespg
force-pushed
the
embed/5-markdown
branch
from
December 2, 2026 20:07
64e0d93 to
1b36d49
Compare
josemontespg
force-pushed
the
embed/5-markdown
branch
from
December 2, 2026 21:07
1b36d49 to
4faaddf
Compare
josemontespg
force-pushed
the
embed/5-markdown
branch
from
December 2, 2026 21:28
4faaddf to
454e474
Compare
josemontespg
force-pushed
the
embed/5-markdown
branch
from
December 3, 2026 18:34
454e474 to
a8d575d
Compare
This branch has not been deployed
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
The basic catalog renders every body
Textas markdown, but the app built bya2ui-embed buildhad no markdown renderer. Every view logged a[MarkdownDirective]warning and showed markdown as raw characters, which hurts tool UIs that show content like GitHub issue bodies.The built app now renders markdown with
@a2ui/markdown-itby default.startEmbedApptakes an optionalmarkdownrenderer and passes it to the basic catalog through its Lit context. The build config getsmarkdown: boolean(defaulttrue), and the generated entry passesrenderMarkdownonly when it is on. The choice lives at build time because only the build can leave the renderer out of the bundle: a runtime default would always import it. Without a renderer the app escapes the text, somarkdown: falseshows the text as typed without the warning.Tool results are untrusted.
renderMarkdownkeeps raw HTML as text, dropsjavascript:links and sanitizes with DOMPurify, and images still follow the host CSP. The app now intercepts link clicks and openshttp:,https:andmailto:links throughui/open-link, so a link never navigates the sandboxed frame.Changes
startEmbedApp: newmarkdownoption, provided throughContext.markdownon the app root, with an escaping renderer when it is omitted. Clicks on links callapp.openLink, or show a notice when the host lacksopenLinks.markdownconfig option, validated as a boolean. The entry imports@a2ui/markdown-itresolved from@a2ui/embed, which now depends on it and on@lit/context.markdown: false(+2,348).ui/open-linkwithout navigation, the notice withoutopenLinks, and plain text without a renderer. The build tests cover the option and its validation, the CSP test checks the renderer is passed, and the e2e test checks rendered markdown under the default MCP Apps CSP.Verification
yarn workspace @a2ui/embed test(clean wireit cache): node 165/165, karma 30/30.yarn workspace @a2ui/embed lint, prettier on changed files, and./scripts/fix_licenses.py --checkpass.