diff --git a/CHANGELOG.md b/CHANGELOG.md index bf7cd3c50..ddf0a10c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Linear issue links in chat responses now render as a rich card-style UI showing the Linear logo, issue identifier, and title instead of plain hyperlinks. [#1060](https://github.com/sourcebot-dev/sourcebot/pull/1060) +### Changed +- Links in Ask Sourcebot chat responses now open in a new tab with a subtle external link icon indicator. [#1059](https://github.com/sourcebot-dev/sourcebot/pull/1059) + ## [4.16.7] - 2026-04-03 ### Fixed diff --git a/packages/web/src/features/chat/components/chatThread/markdownRenderer.tsx b/packages/web/src/features/chat/components/chatThread/markdownRenderer.tsx index 7f72f8ee8..f8331ef00 100644 --- a/packages/web/src/features/chat/components/chatThread/markdownRenderer.tsx +++ b/packages/web/src/features/chat/components/chatThread/markdownRenderer.tsx @@ -5,7 +5,7 @@ import { SearchQueryParams } from '@/lib/types'; import { cn, createPathWithQueryParams } from '@/lib/utils'; import type { Element, Root } from "hast"; import { Schema as SanitizeSchema } from 'hast-util-sanitize'; -import { CopyIcon, SearchIcon } from 'lucide-react'; +import { CopyIcon, ExternalLinkIcon, SearchIcon } from 'lucide-react'; import type { Heading, Nodes } from "mdast"; import { findAndReplace } from 'mdast-util-find-and-replace'; import { useRouter } from 'next/navigation'; @@ -174,6 +174,30 @@ const MarkdownRendererComponent = forwardRef { + if (href) { + const match = LINEAR_ISSUE_URL_REGEX.exec(href); + if (match) { + const identifier = match[1]; + const titleSlug = match[2]; + const title = titleSlug.replace(/-/g, ' '); + return ; + } + } + return ( + + {children} + + + ); + }, []); + const renderCode = useCallback(({ className, children, node, ...rest }: React.JSX.IntrinsicElements['code'] & { node?: Element }) => { const text = children?.toString().trimEnd() ?? ''; @@ -231,19 +255,6 @@ const MarkdownRendererComponent = forwardRef { - if (href) { - const match = LINEAR_ISSUE_URL_REGEX.exec(href); - if (match) { - const identifier = match[1]; - const titleSlug = match[2]; - const title = titleSlug.replace(/-/g, ' '); - return ; - } - } - return {children}; - }, []); - return (