@devries-cameron20 / t3code-1 / commits / f999dc1018
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): preserve single tildes in sent user messages (#35859)

Julius Marminge committed Nov 12, 2026 at 19:30 UTC f999dc1018d987a8c73895f17b3c1275c592ea31
5 files changed +43 -2
apps/web/src/components/chat/MessagesTimeline.browser.test.tsx
+19
@@ -861,6 +861,25 @@ describe("MessagesTimeline messages", () => {
861 expect((globalThis as { __t3Xss?: number }).__t3Xss).toBeUndefined();
862 });
863
864 + it("keeps single tildes in user paths literal without changing double tildes or assistant text", async () => {
865 + const source =
866 + "Install the skill as ~/folder-a/skills/x, then follow the guide (~/folder-a/guide.md).";
867 + await using screen = await renderTimeline([
868 + message(source),
869 + message("Drop ~~the old plan~~", {}, "message-2"),
870 + message(source, { role: "assistant" }, "assistant-1"),
871 + ]);
872 + const [user, doubleTilde, assistant] = screen.container.querySelectorAll<HTMLElement>(
873 + "[data-timeline-row-kind=message]",
874 + );
875 + expect(user?.textContent).toContain(source);
876 + expect(user?.querySelector("del")).toBeNull();
877 + expect(doubleTilde?.querySelector("del")?.textContent).toBe("the old plan");
878 + expect(assistant?.querySelector("del")?.textContent).toBe(
879 + "/folder-a/skills/x, then follow the guide (",
880 + );
881 + });
882 +
883 it("renders sanitized raw HTML in assistant messages", async () => {
884 await using screen = await renderTimeline([
885 message(
apps/web/src/components/chat/TimelineUserMessageRow.tsx
+8 -2
@@ -1,6 +1,9 @@
1 import { InlineAudioPreview } from "../files/InlineAudioPreview";
2 import { filePreviewKind } from "@t3tools/shared/filePreview";
3 -import { remarkEnableOrderedListNumbers } from "@t3tools/shared/markdownPipeline";
3 +import {
4 + CHAT_USER_MARKDOWN_REMARK_PLUGINS,
5 + remarkEnableOrderedListNumbers,
6 +} from "@t3tools/shared/markdownPipeline";
7 import { findRevealRef } from "./markdownFindContext";
8 import {
9 type EnvironmentId,
@@ -1200,7 +1203,10 @@ const CollapsibleUserMessageBody = memo(function CollapsibleUserMessageBody(prop
1203 );
1204 });
1205
1203 -const USER_MESSAGE_REMARK_PLUGINS = [remarkEnableOrderedListNumbers];
1206 +const USER_MESSAGE_REMARK_PLUGINS = [
1207 + ...CHAT_USER_MARKDOWN_REMARK_PLUGINS,
1208 + remarkEnableOrderedListNumbers,
1209 +];
1210
1211 const UserMessageBody = memo(function UserMessageBody(props: {
1212 text: string;
packages/shared/src/markdownPipeline.ts
+6
@@ -274,6 +274,12 @@ export const CHAT_MARKDOWN_REMARK_PLUGINS_WITH_BREAKS: PluggableList = [
274 remarkNormalizeLinksAndTagInlineCode,
275 ];
276
277 +// Users type paths like ~/a and (~/b, which GFM's single-tilde strikethrough hides as <del>.
278 +// Appended after the base list, this reconfigures its remark-gfm entry; ~~double~~ still strikes.
279 +export const CHAT_USER_MARKDOWN_REMARK_PLUGINS: PluggableList = [
280 + [remarkGfm, { singleTilde: false }],
281 +];
282 +
283 // Start tags an HTML parser closes an open `<p>` for.
284 const CLOSES_PARAGRAPH = new Set(
285 "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(
packages/shared/src/threadFindText.test.ts
+8
@@ -21,6 +21,14 @@ it("excludes review attachments rendered as context chips", () => {
21 ]);
22 });
23
24 +it("indexes single tildes in user paths as typed", () => {
25 + const text = "Install as ~/a/x, then read (~/a/guide.md).";
26 + expect(searchableMessageSegments({ role: "user", text, streaming: false })?.join("")).toBe(text);
27 + expect(
28 + searchableMessageSegments({ role: "user", text: "Drop ~~old~~", streaming: false })?.join(""),
29 + ).toBe("Drop old");
30 +});
31 +
32 it("excludes structured context chips without joining text across them", () => {
33 expect(
34 searchableMessageSegments({
packages/shared/src/threadFindText.ts
+2
@@ -37,6 +37,7 @@ import {
37 CHAT_MARKDOWN_REHYPE_PLUGINS,
38 CHAT_MARKDOWN_REMARK_PLUGINS,
39 CHAT_MARKDOWN_REMARK_PLUGINS_WITH_BREAKS,
40 + CHAT_USER_MARKDOWN_REMARK_PLUGINS,
41 } from "./markdownPipeline.ts";
42
43 // Inline wrappers (including Shiki token spans) must not split a search phrase.
@@ -94,6 +95,7 @@ const insightBreaksProcessor = assistantTextProcessor(true, true);
95 const userProcessor = unified()
96 .use(remarkParse)
97 .use(CHAT_MARKDOWN_REMARK_PLUGINS_WITH_BREAKS)
98 + .use(CHAT_USER_MARKDOWN_REMARK_PLUGINS)
99 .use(remarkRehype, { allowDangerousHtml: true });
100
101 interface TextTree {