@devries-cameron20 / t3code Mirror · read-only / commits / f161a4d2b5
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 14:45 UTC

fix(shared): preserve literal ampersands in citation Markdown paths (#28103)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Behzad Motaghi committed Nov 14, 2026 at 12:47 UTC f161a4d2b59ef461c7283f0824c279d10e533ff9
3 files changed +12 -1
packages/shared/src/codexFileCitations.test.ts
+1 -1
@@ -64,7 +64,7 @@ describe("codexFileCitationMarkdown", () => {
64 path: "reports/*draft*_[copy]`<&.txt",
65 });
66 expect(citation && codexFileCitationMarkdown(citation)).toBe(
67 - "[\\*draft\\*\\_\\[copy\\]\\`\\<\\&.txt](<reports/*draft*_[copy]`%3C&.txt>)",
67 + "[\\*draft\\*\\_\\[copy\\]\\`\\<\\&.txt](<reports/*draft*_[copy]`%3C%26.txt>)",
68 );
69 });
70 });
packages/shared/src/codexFileCitations.ts
+1
@@ -45,6 +45,7 @@ function markdownLabel(value: string): string {
45 function markdownDestination(value: string): string {
46 return value
47 .replaceAll("\\", "%5C")
48 + .replaceAll("&", "%26")
49 .replaceAll("<", "%3C")
50 .replaceAll(">", "%3E")
51 .replaceAll("\r", "%0D")
packages/shared/src/codexMarkdownDirectives.test.ts
+10
@@ -106,6 +106,16 @@ describe.each([
106 expect(link?.type).toBe("link");
107 expect(parseMarkdownFileLink(link?.url ?? "")).toEqual({ path, line: 7 });
108 });
109 +
110 + it("keeps an entity-like ampersand in the path literal", () => {
111 + const markdown = render(
112 + ':codex-file-citation{path="/tmp/a&amp;copy;.txt" line_range_start="7"}',
113 + );
114 + const link = parseOrdinaryMarkdown(markdown).children?.[0]?.children?.[0];
115 +
116 + expect(link?.type).toBe("link");
117 + expect(parseMarkdownFileLink(link?.url ?? "")).toEqual({ path: "/tmp/a&copy;.txt", line: 7 });
118 + });
119 });
120
121 describe("native Markdown adapters", () => {