Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -174,6 +174,30 @@ const MarkdownRendererComponent = forwardRef<HTMLDivElement, MarkdownRendererPro
)
}, []);

const renderAnchor = useCallback(({ href, children, ...rest }: React.JSX.IntrinsicElements['a']) => {
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 <LinearIssueCard identifier={identifier} title={title} href={href} />;
}
}
return (
<a
href={href}
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center gap-0.5"
{...rest}
>
{children}
<ExternalLinkIcon className="inline w-3 h-3 mb-0.5 opacity-60" />
</a>
);
}, []);

const renderCode = useCallback(({ className, children, node, ...rest }: React.JSX.IntrinsicElements['code'] & { node?: Element }) => {
const text = children?.toString().trimEnd() ?? '';

Expand Down Expand Up @@ -231,19 +255,6 @@ const MarkdownRendererComponent = forwardRef<HTMLDivElement, MarkdownRendererPro

}, [router]);

const renderAnchor = useCallback(({ href, children, ...rest }: React.JSX.IntrinsicElements['a']) => {
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 <LinearIssueCard identifier={identifier} title={title} href={href} />;
}
}
return <a href={href} target="_blank" rel="noopener noreferrer" {...rest}>{children}</a>;
}, []);

return (
<div
ref={ref}
Expand Down
Loading