diff --git a/frontend/src/components/workspace/messages/message-list-item.tsx b/frontend/src/components/workspace/messages/message-list-item.tsx index c69dc10..96049ae 100644 --- a/frontend/src/components/workspace/messages/message-list-item.tsx +++ b/frontend/src/components/workspace/messages/message-list-item.tsx @@ -30,7 +30,7 @@ import { type UploadedFile, } from "@/core/messages/utils"; import { useRehypeSplitWordsIntoSpans } from "@/core/rehype"; -import { streamdownPlugins } from "@/core/streamdown"; +import { humanMessagePlugins, streamdownPlugins } from "@/core/streamdown"; import { cn } from "@/lib/utils"; import { CopyButton } from "../copy-button"; @@ -222,10 +222,11 @@ function MessageContent_({ }), [citationMap, thread_id, isHuman]); // Render message response + // Human messages use humanMessagePlugins (no autolink) to prevent URL bleeding into adjacent text const messageResponse = cleanContent ? ( {cleanContent} diff --git a/frontend/src/core/streamdown/plugins.ts b/frontend/src/core/streamdown/plugins.ts index ce99f31..b0d9824 100644 --- a/frontend/src/core/streamdown/plugins.ts +++ b/frontend/src/core/streamdown/plugins.ts @@ -12,3 +12,15 @@ export const streamdownPlugins = { [rehypeKatex, { output: "html" }], ] as StreamdownProps["rehypePlugins"], }; + +// Plugins for human messages - no autolink to prevent URL bleeding into adjacent text +export const humanMessagePlugins = { + remarkPlugins: [ + // Use remark-gfm without autolink literals by not including it + // Only include math support for human messages + [remarkMath, { singleDollarTextMath: true }], + ] as StreamdownProps["remarkPlugins"], + rehypePlugins: [ + [rehypeKatex, { output: "html" }], + ] as StreamdownProps["rehypePlugins"], +};