GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(shared): preserve literal ampersands in citation Markdown paths (… · pingdotgg/t3code@f161a4d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/shared/src
    • codexFileCitations.test.ts
    • codexFileCitations.ts
    • codexMarkdownDirectives.test.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/shared/src/codexFileCitations.test.ts‎

Copy file name to clipboardExpand all lines: packages/shared/src/codexFileCitations.test.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe("codexFileCitationMarkdown", () => {
6464
path: "reports/*draft*_[copy]`<&.txt",
6565
});
6666
expect(citation && codexFileCitationMarkdown(citation)).toBe(
67-
"[\\*draft\\*\\_\\[copy\\]\\`\\<\\&.txt](<reports/*draft*_[copy]`%3C&.txt>)",
67+
"[\\*draft\\*\\_\\[copy\\]\\`\\<\\&.txt](<reports/*draft*_[copy]`%3C%26.txt>)",
6868
);
6969
});
7070
});
Collapse file

‎packages/shared/src/codexFileCitations.ts‎

Copy file name to clipboardExpand all lines: packages/shared/src/codexFileCitations.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ function markdownLabel(value: string): string {
4545
function markdownDestination(value: string): string {
4646
return value
4747
.replaceAll("\\", "%5C")
48+
.replaceAll("&", "%26")
4849
.replaceAll("<", "%3C")
4950
.replaceAll(">", "%3E")
5051
.replaceAll("\r", "%0D")
Collapse file

‎packages/shared/src/codexMarkdownDirectives.test.ts‎

Copy file name to clipboardExpand all lines: packages/shared/src/codexMarkdownDirectives.test.ts
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ describe.each([
106106
expect(link?.type).toBe("link");
107107
expect(parseMarkdownFileLink(link?.url ?? "")).toEqual({ path, line: 7 });
108108
});
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+
});
109119
});
110120

111121
describe("native Markdown adapters", () => {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.