diff --git a/ui/src/components/MarkdownBody.test.tsx b/ui/src/components/MarkdownBody.test.tsx index 326527a3ed..8f64bf8f6f 100644 --- a/ui/src/components/MarkdownBody.test.tsx +++ b/ui/src/components/MarkdownBody.test.tsx @@ -325,6 +325,7 @@ describe("MarkdownBody", () => { // icon can never be orphaned on the previous line from the URL text. expect(html).toMatch(/.*lucide-github.*?<\/svg>h<\/span>/); expect(html).toContain("ttps://github.com/paperclipai/paperclip/pull/4099"); + expect(html).not.toContain("lucide-external-link"); }); it("prefixes GitHub autolinks with the GitHub icon", () => { diff --git a/ui/src/components/MarkdownBody.tsx b/ui/src/components/MarkdownBody.tsx index 0be4eb81e2..b155032f78 100644 --- a/ui/src/components/MarkdownBody.tsx +++ b/ui/src/components/MarkdownBody.tsx @@ -140,6 +140,8 @@ function renderLinkBody( ): ReactNode { if (!leadingIcon && !trailingIcon) return children; + // React-markdown can pass arrays/elements for styled link text; the nowrap + // splitting below is intentionally limited to plain text links. if (typeof children === "string" && children.length > 0) { if (children.length === 1) { return ( @@ -332,7 +334,7 @@ export function MarkdownBody({ const leadingIcon = isGitHubLink ? (