Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

fix(web): open links in agent chat in a new tab (#184)

Croff02fb62264eb1
diff --git a/apps/web/src/components/common/Markdown.tsx b/apps/web/src/components/common/Markdown.tsx
index 1461b88c..918e9a20 100644
--- a/apps/web/src/components/common/Markdown.tsx
+++ b/apps/web/src/components/common/Markdown.tsx
@@ -3,9 +3,10 @@ import { renderMarkdown } from '@/lib/markdown';
// Renders markdown text as formatted HTML with the shared `.md-content` styles
// (headings, lists, code, blockquote, links), without the virtualized-table image
-// sizing the markdown table cell adds.
+// sizing the markdown table cell adds. Links open in a new tab so following one
+// does not replace the view the reader was on.
export default function Markdown({ children }: { children: string }) {
- const html = useMemo(() => renderMarkdown(children), [children]);
+ const html = useMemo(() => renderMarkdown(children, { newTabLinks: true }), [children]);
// `dir="auto"` reads the direction from the text itself, so an Arabic comment in
// an English interface — and the reverse — is laid out the way it was written.
return <div dir="auto" className="md-content" dangerouslySetInnerHTML={{ __html: html }} />;
diff --git a/apps/web/src/lib/markdown.ts b/apps/web/src/lib/markdown.ts
index f0fe83ba..f3af70c5 100644
--- a/apps/web/src/lib/markdown.ts
+++ b/apps/web/src/lib/markdown.ts
@@ -1,8 +1,8 @@
import { marked } from 'marked';
import DOMPurify from 'isomorphic-dompurify';
-// Content that links away from the app (release notes) asks for newTabLinks, so a
-// link does not replace the app with GitHub.
+// Content whose links lead away from the current view (release notes, agent chat)
+// asks for newTabLinks, so following one does not replace what the reader was on.
export interface HtmlOptions {
newTabLinks?: boolean;
}