The best way to control Claude Code, Codex and more from any computer or phone
fix(web): show minimap previews as plain text, not raw markdown (#15715)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Nikhil Nigam committed
Oct 20, 2026 at 07:28 UTC
e6765094cb6b00a54dde18b4642bb92ed53837ad
5 files changed
+107
-6
apps/web/package.json
+2
-1
@@ -71,8 +71,10 @@
71
"react-markdown": "^10.1.0",
72
"remark-gfm": "catalog:",
73
"remark-math": "6.0.0",
74
+ "remark-parse": "catalog:",
75
"tailwind-merge": "^3.4.0",
76
"unbash": "^5.0.0",
77
+ "unified": "catalog:",
78
"use-sync-external-store": "^1.6.0",
79
"zustand": "^5.0.11"
80
},
@@ -94,7 +96,6 @@
96
"oxc-transform-react": "~0.152.0",
97
"playwright": "1.60.0",
98
"tailwindcss": "^4.0.0",
97
- "unified": "catalog:",
99
"vite": "catalog:",
100
"vite-plus": "catalog:"
101
}
apps/web/src/components/chat/timelineMinimapItems.test.ts
+44
@@ -64,6 +64,50 @@ describe("timeline minimap previews", () => {
64
expect(resolveTimelineMinimapPreview(null)).toBeNull();
65
});
66
67
+ it("renders assistant markdown only when resolving a preview and keeps user text literal", () => {
68
+ const userText = "Explain **operators** and [x] in [the docs](https://example.com/docs)";
69
+ const assistantText = [
70
+ "## Operators",
71
+ "Use **either** option from [the docs](https://example.com/docs).",
72
+ "",
73
+ "| Operator | Meaning |",
74
+ "| --- | :---: |",
75
+ "| `a \\| b` | either |",
76
+ "",
77
+ "- [x] Match `**/*.ts` files",
78
+ "",
79
+ "[x] deployment complete",
80
+ "",
81
+ "> Note: ~~old~~ new ",
82
+ "> Next line",
83
+ "",
84
+ "```sh",
85
+ "# install deps",
86
+ "- **not bold**",
87
+ "const snake_case = a * b;",
88
+ "```",
89
+ "",
90
+ "foo<br>bar",
91
+ "",
92
+ "<div>Critical <em>answer</em></div>",
93
+ ].join("\n");
94
+ const [item] = deriveTimelineMinimapItems(
95
+ rows([
96
+ ["user", userText],
97
+ ["assistant", assistantText],
98
+ ]),
99
+ );
100
+
101
+ expect(item).toMatchObject({ userText, assistantText });
102
+ expect(resolveTimelineMinimapPreview(item!)).toEqual({
103
+ ...item,
104
+ userText,
105
+ assistantText:
106
+ "Operators Use either option from the docs. Operator Meaning a | b either Match **/*.ts files [x] deployment complete Note: old new Next line # install deps - **not bold** const snake_case = a * b; foo bar Critical answer",
107
+ });
108
+ expect(item).toMatchObject({ userText, assistantText });
109
+ });
110
+
111
it("shows fresh streaming text without changing the jump target", () => {
112
const first = deriveTimelineMinimapItems(
113
rows([
apps/web/src/components/chat/timelineMinimapItems.ts
+44
-1
@@ -1,3 +1,8 @@
1
+import type { Nodes } from "mdast";
2
+import remarkGfm from "remark-gfm";
3
+import remarkParse from "remark-parse";
4
+import { unified } from "unified";
5
+
6
import type { MessagesTimelineRow } from "./MessagesTimeline.logic";
7
8
export interface TimelineMinimapItem {
@@ -47,6 +52,39 @@ function resolveFinalAssistantTextForTurn(
52
return finalAssistantText;
53
}
54
55
+const markdownPreviewParser = unified().use(remarkParse).use(remarkGfm).freeze();
56
+
57
+const INLINE_PARENT_TYPES = new Set<Nodes["type"]>([
58
+ "paragraph",
59
+ "heading",
60
+ "tableCell",
61
+ "emphasis",
62
+ "strong",
63
+ "delete",
64
+ "link",
65
+ "linkReference",
66
+]);
67
+
68
+function markdownNodeText(node: Nodes): string {
69
+ if (node.type === "html") {
70
+ return node.value
71
+ .replace(/<!--[\s\S]*?(?:-->|$)/g, "")
72
+ .replace(/<\/?([a-z][\w-]*)(?:[^"'<>]|"[^"]*"|'[^']*')*>/gi, (_, tag: string) =>
73
+ /^(?:address|article|aside|blockquote|br|dd|details|div|dl|dt|figcaption|figure|footer|h[1-6]|header|hr|li|main|nav|ol|p|pre|section|summary|table|tbody|td|th|thead|tr|ul)$/i.test(
74
+ tag,
75
+ )
76
+ ? " "
77
+ : "",
78
+ );
79
+ }
80
+ if (node.type === "break") return " ";
81
+ if ("value" in node) return node.value;
82
+ if (node.type === "image" || node.type === "imageReference") return node.alt ?? "";
83
+ if (!("children" in node)) return "";
84
+ const separator = INLINE_PARENT_TYPES.has(node.type) ? "" : " ";
85
+ return node.children.map(markdownNodeText).join(separator);
86
+}
87
+
88
function compactMinimapPreview(text: string | null | undefined) {
89
const compact = text?.replace(/\s+/g, " ").trim() ?? "";
90
return compact.length > 0 ? compact : null;
@@ -60,6 +98,11 @@ export function resolveTimelineMinimapPreview(
98
: {
99
...item,
100
userText: compactMinimapPreview(item.userText),
63
- assistantText: compactMinimapPreview(item.assistantText),
101
+ // The tooltip shows three lines; bound parsing work while long responses stream.
102
+ assistantText: compactMinimapPreview(
103
+ item.assistantText === null
104
+ ? null
105
+ : markdownNodeText(markdownPreviewParser.parse(item.assistantText.slice(0, 1_500))),
106
+ ),
107
};
108
}
packages/ssh/src/tunnel.test.ts
+11
-1
@@ -1460,7 +1460,17 @@ server.listen(Number(flag("--port")), "127.0.0.1", () => {
1460
),
1461
);
1462
process.kill(zombie, "SIGKILL");
1463
- assert.include((yield* runScript(home, ["-c", `ps -o stat= -p ${zombie}`])).stdout, "Z");
1463
+ // SIGKILL delivery is asynchronous; establish the zombie fixture before launching.
1464
+ const zombieState = yield* runScript(home, [
1465
+ "-c",
1466
+ `attempt=0; while [ "$attempt" -lt 100 ]; do
1467
+ state=$(ps -o stat= -p ${zombie}) || exit 1
1468
+ case "$state" in *Z*) printf '%s\\n' "$state"; exit 0;; esac
1469
+ attempt=$((attempt + 1))
1470
+ done; printf '%s\\n' "$state"; exit 1`,
1471
+ ]);
1472
+ assert.equal(zombieState.exitCode, 0, zombieState.stdout);
1473
+ assert.include(zombieState.stdout, "Z");
1474
yield* fs.writeFileString(`${stateDir}/pid`, `${zombie}\n`);
1475
yield* fs.writeFileString(
1476
`${home}/.t3/userdata/server-runtime.json`,
pnpm-lock.yaml
+6
-3
@@ -981,12 +981,18 @@ importers:
981
remark-math:
982
specifier: 6.0.0
983
version: 6.0.0
984
+ remark-parse:
985
+ specifier: 'catalog:'
986
+ version: 11.0.0
987
tailwind-merge:
988
specifier: ^3.4.0
989
version: 3.6.0
990
unbash:
991
specifier: ^5.0.0
992
version: 5.0.0
993
+ unified:
994
+ specifier: 'catalog:'
995
+ version: 11.0.5
996
use-sync-external-store:
997
specifier: ^1.6.0
998
version: 1.6.0(react@19.3.0)
@@ -1045,9 +1051,6 @@ importers:
1051
tailwindcss:
1052
specifier: 4.3.3
1053
version: 4.3.3
1048
- unified:
1049
- specifier: 'catalog:'
1050
- version: 11.0.5
1054
vite:
1055
specifier: npm:@voidzero-dev/vite-plus-core@1.0.0
1056
version: '@voidzero-dev/vite-plus-core@1.0.0(@types/node@24.12.4)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.48.0)(typescript@7.0.2)(unrun@0.2.39)(yaml@2.9.0)'