diff --git a/ui/src/components/MarkdownBody.test.tsx b/ui/src/components/MarkdownBody.test.tsx
index 63e92cb5..8f64bf8f 100644
--- a/ui/src/components/MarkdownBody.test.tsx
+++ b/ui/src/components/MarkdownBody.test.tsx
@@ -316,12 +316,16 @@ describe("MarkdownBody", () => {
expect(html).toContain('rel="noreferrer"');
});
- it("prefixes GitHub markdown links with the GitHub icon", () => {
+ it("prefixes GitHub markdown links with the GitHub icon glued to the first character", () => {
const html = renderMarkdown("[https://github.com/paperclipai/paperclip/pull/4099](https://github.com/paperclipai/paperclip/pull/4099)");
expect(html).toContain('https://github.com/paperclipai/paperclip/pull/4099");
+ // The icon and first character "h" must sit in a no-wrap span so the
+ // 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", () => {
@@ -338,6 +342,22 @@ describe("MarkdownBody", () => {
expect(html).not.toContain("lucide-github");
});
+ it("suffixes external links with a new-tab icon glued to the last character", () => {
+ const html = renderMarkdown("[docs](https://example.com/docs)");
+
+ expect(html).toContain('target="_blank"');
+ expect(html).toContain("lucide-external-link");
+ // Last character "s" must sit in a no-wrap span with the icon so the
+ // indicator never wraps away from the link text.
+ expect(html).toMatch(/s