Merge remote-tracking branch 'origin/main' into kumareth/workspaces

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	apps/web/app/components/chat-message.tsx
This commit is contained in:
kumarabhirup 2026-02-21 15:00:45 -08:00
commit d88ed44521
No known key found for this signature in database
GPG Key ID: DB7CA2289CAB0167

View File

@ -555,7 +555,7 @@ function createMarkdownComponents(
onFilePathClick?: FilePathClickHandler,
): Components {
return {
// Open external links in new tab
// Open external links in new tab; intercept local file-path links
a: ({ href, children, ...props }) => {
const rawHref = typeof href === "string" ? href : "";
const normalizedHref = normalizePathReference(rawHref);
@ -583,15 +583,18 @@ function createMarkdownComponents(
</a>
);
},
// Render images with loading=lazy
img: ({ src, alt, ...props }) => (
// eslint-disable-next-line @next/next/no-img-element
<img src={src} alt={alt ?? ""} loading="lazy" {...props} />
),
// Route local image paths through raw-file API so workspace images render
img: ({ src, alt, ...props }) => {
const resolvedSrc = typeof src === "string" && !src.startsWith("http://") && !src.startsWith("https://") && !src.startsWith("data:")
? `/api/workspace/raw-file?path=${encodeURIComponent(src)}`
: src;
return (
// eslint-disable-next-line @next/next/no-img-element
<img src={resolvedSrc} alt={alt ?? ""} loading="lazy" {...props} />
);
},
// Syntax-highlighted fenced code blocks
pre: ({ children, ...props }) => {
// react-markdown wraps code blocks in <pre><code>...
// Extract the code element to get lang + content
const child = Array.isArray(children) ? children[0] : children;
if (
child &&