diff --git a/apps/web/src/components/chat/TimelineUserMessageRow.tsx b/apps/web/src/components/chat/TimelineUserMessageRow.tsx
index 79f0c1fc9a41d..7cef73090fee8 100644
--- a/apps/web/src/components/chat/TimelineUserMessageRow.tsx
+++ b/apps/web/src/components/chat/TimelineUserMessageRow.tsx
@@ -1,5 +1,6 @@
import { InlineAudioPreview } from "../files/InlineAudioPreview";
import { filePreviewKind } from "@t3tools/shared/filePreview";
+import { CHAT_USER_MARKDOWN_REMARK_PLUGINS } from "@t3tools/shared/markdownPipeline";
import { findRevealRef } from "./markdownFindContext";
import {
type EnvironmentId,
@@ -1203,6 +1204,7 @@ const UserMessageBody = memo(function UserMessageBody(props: {
className="text-foreground"
lineBreaks
parseRawHtml={false}
+ extraRemarkPlugins={CHAT_USER_MARKDOWN_REMARK_PLUGINS}
renderContextReference={props.renderContextReference}
headingLevelOffset={MESSAGE_HEADING_LEVEL}
/>
diff --git a/apps/web/src/components/chat/UserMessageContextChips.tsx b/apps/web/src/components/chat/UserMessageContextChips.tsx
index 2638692caab26..ab9cc1db7bf3c 100644
--- a/apps/web/src/components/chat/UserMessageContextChips.tsx
+++ b/apps/web/src/components/chat/UserMessageContextChips.tsx
@@ -45,6 +45,7 @@ import {
reviewCommentContextLabel,
} from "~/lib/composerContextRecords";
import { formatComposerContextReference } from "@t3tools/shared/composerContextReferences";
+import { CHAT_USER_MARKDOWN_REMARK_PLUGINS } from "@t3tools/shared/markdownPipeline";
import { ContextChip, ContextChipLabel, type ContextChipKind } from "../ContextChip";
import { createContextPresentationRegistry } from "../contextPresentationRegistry";
import type { ChatMarkdownContextReference } from "../ChatMarkdown";
@@ -564,6 +565,7 @@ function UserMessageReviewCommentCard({ comment }: { comment: ReviewCommentConte
skills={ctx.skills}
parseRawHtml={false}
lineBreaks
+ extraRemarkPlugins={CHAT_USER_MARKDOWN_REMARK_PLUGINS}
/>
)}
diff --git a/apps/web/src/components/composerContextPresentation.tsx b/apps/web/src/components/composerContextPresentation.tsx
index 845e921725b55..9a26913da8a48 100644
--- a/apps/web/src/components/composerContextPresentation.tsx
+++ b/apps/web/src/components/composerContextPresentation.tsx
@@ -1,5 +1,6 @@
import ChatMarkdown from "./ChatMarkdown";
import { isSvgAttachment } from "@t3tools/shared/image";
+import { CHAT_USER_MARKDOWN_REMARK_PLUGINS } from "@t3tools/shared/markdownPipeline";
import { ReadOnlySourcePreview } from "./files/AttachmentFilePreview";
import type {
EnvironmentContextRecord,
@@ -291,7 +292,13 @@ function ComposerReviewCommentDetails({ comment }: { comment: ReviewCommentConte
{comment.sectionTitle} · {comment.rangeLabel}
- {comment.text.trim() ?
` for. const CLOSES_PARAGRAPH = new Set( "address article aside blockquote center details dialog dir div dl fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 header hgroup hr li listing main menu nav ol p plaintext pre search section summary table ul xmp dd dt".split( diff --git a/packages/shared/src/threadFindText.test.ts b/packages/shared/src/threadFindText.test.ts index 77a0874c21336..88c51a4ddf744 100644 --- a/packages/shared/src/threadFindText.test.ts +++ b/packages/shared/src/threadFindText.test.ts @@ -117,3 +117,9 @@ it("indexes the citation chip label instead of its link text", () => { "my note", ]); }); + +it("indexes web citation markers as typed in user messages only", () => { + const text = "Explain citeturn0search0 please"; + expect(searchableMessageSegments({ role: "user", text, streaming: false })).toEqual([text]); + expect(assistantSegments(text)).toEqual(["Explain please"]); +}); diff --git a/packages/shared/src/threadFindText.ts b/packages/shared/src/threadFindText.ts index 3afec6e04729e..f51b9370d963b 100644 --- a/packages/shared/src/threadFindText.ts +++ b/packages/shared/src/threadFindText.ts @@ -36,6 +36,7 @@ import { CHAT_MARKDOWN_REHYPE_PLUGINS, CHAT_MARKDOWN_REMARK_PLUGINS, CHAT_MARKDOWN_REMARK_PLUGINS_WITH_BREAKS, + CHAT_USER_MARKDOWN_REMARK_PLUGINS, } from "./markdownPipeline.ts"; // Inline wrappers (including Shiki token spans) must not split a search phrase. @@ -91,6 +92,7 @@ const assistantBreaksProcessor = unified() const userProcessor = unified() .use(remarkParse) .use(CHAT_MARKDOWN_REMARK_PLUGINS_WITH_BREAKS) + .use(CHAT_USER_MARKDOWN_REMARK_PLUGINS) .use(remarkRehype, { allowDangerousHtml: true }); interface TextTree {