From 09d9f1152eecdb3d4922bacbed43d61dafabfd9d Mon Sep 17 00:00:00 2001 From: _Kerman Date: Fri, 23 Oct 2026 15:53:32 +0800 Subject: [PATCH] fix(web): parse colon line suffixes in Markdown file links --- .../expected/markdown-colon-file-links.md | 6 +++ .../session.v3.jsonl | 10 +++++ apps/web/tests/markdown-file-links.e2e.ts | 37 +++++++++++++++++++ .../markdown-file-line-suffix/guide.i18n.yaml | 16 ++++++++ .../markdown-file-line-suffix/guide.md | 17 +++++++++ .../markdown-file-line-suffix/guide.zh.md | 17 +++++++++ .../client/ui-primitives/README.i18n.yaml | 4 +- packages/client/ui-primitives/README.md | 2 +- packages/client/ui-primitives/README.zh.md | 2 +- .../ui-primitives/src/markdown/file-link.ts | 16 ++++---- .../tests/markdown-file-links.client.spec.tsx | 14 +++++++ 11 files changed, 130 insertions(+), 11 deletions(-) create mode 100644 apps/web/tests/expected/markdown-colon-file-links.md create mode 100644 apps/web/tests/fixtures/markdown-colon-file-links/session.v3.jsonl create mode 100644 docs/upgrade-guide/v0.2.1-rc.3/markdown-file-line-suffix/guide.i18n.yaml create mode 100644 docs/upgrade-guide/v0.2.1-rc.3/markdown-file-line-suffix/guide.md create mode 100644 docs/upgrade-guide/v0.2.1-rc.3/markdown-file-line-suffix/guide.zh.md diff --git a/apps/web/tests/expected/markdown-colon-file-links.md b/apps/web/tests/expected/markdown-colon-file-links.md new file mode 100644 index 0000000000..803683a783 --- /dev/null +++ b/apps/web/tests/expected/markdown-colon-file-links.md @@ -0,0 +1,6 @@ +- paragraph: + - button "Relative colon:24–30" + - text: · + - button "Absolute colon:30" + - text: · + - button "Fragment:12" diff --git a/apps/web/tests/fixtures/markdown-colon-file-links/session.v3.jsonl b/apps/web/tests/fixtures/markdown-colon-file-links/session.v3.jsonl new file mode 100644 index 0000000000..615c2f7ed8 --- /dev/null +++ b/apps/web/tests/fixtures/markdown-colon-file-links/session.v3.jsonl @@ -0,0 +1,10 @@ +{"version":3,"isSeeded":false,"createdAt":0,"cwd":"{{cwd}}","delegationDepth":0,"type":"session","id":"{{session:1}}"} +{"type":"turn/start","data":{"turn":1}} +{"type":"step/start","data":{"turn":1,"step":1}} +{"type":"system/message","data":{"turn":1,"step":1,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"plugin","plugin":"@deepseek-ai/dsh-system-prompt"},"id":"{{message:1}}"}},"surfaceOp":"append"} +{"type":"user/message","data":{"content":[{"type":"text","text":"Link src/example.txt using relative :24-30, absolute :30, and relative #L12 destinations."}],"source":{"kind":"user","rpcId":"{{rpc:1}}"},"role":"user","id":"{{message:2}}"},"surfaceOp":"append"} +{"type":"session/title","data":{"title":"Colon file references","messageSeqs":[3],"source":{"kind":"fallback"}}} +{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"deepseek-v4-flash"},"tools":"{{tools}}","messagePrefix":["{{messagePrefix}}"]},"reason":"initial"}} +{"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"text","text":"[Relative colon:24–30](src/example.txt:24-30) · [Absolute colon:30]({{cwd}}/src/example.txt:30) · [Fragment:12](src/example.txt#L12)"}],"source":{"provider":"deepseek-official","model":"deepseek-v4-flash","kind":"model"},"id":"{{message:3}}"},"stream":[{"type":"chunk","time":0,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":0,"index":0,"dt":[],"texts":["[Relative colon:24–30](src/example.txt:24-30) · [Absolute colon:30]({{cwd}}/src/example.txt:30) · [Fragment:12](src/example.txt#L12)"]},{"type":"chunk","time":0,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"[Relative colon:24–30](src/example.txt:24-30) · [Absolute colon:30]({{cwd}}/src/example.txt:30) · [Fragment:12](src/example.txt#L12)"}}},{"type":"chunk","time":0,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":1}} +{"type":"turn/end","data":{"turn":1,"reason":{"kind":"completed"}}} diff --git a/apps/web/tests/markdown-file-links.e2e.ts b/apps/web/tests/markdown-file-links.e2e.ts index 62b83dfafb..61a1e732c2 100644 --- a/apps/web/tests/markdown-file-links.e2e.ts +++ b/apps/web/tests/markdown-file-links.e2e.ts @@ -156,6 +156,43 @@ describe('web e2e: Markdown file links', () => { await assertFixtureInventory(SNAPSHOT_DIR, ['session.v3.jsonl', 'links.expected.md', 'preview.expected.md']) }) + it('replays colon line suffixes as locations and shares tabs with fragment links', async () => { + onTestFailed(() => saveFailureShot(page, 'web-e2e-colon-file-links')) + const fixture = new URL('./fixtures/markdown-colon-file-links/session.v3.jsonl', import.meta.url) + const id = await seedSession(scaffold, await readFile(fixture, 'utf8'), 'colon-file-links') + await page.reload({ waitUntil: 'load' }) + const workspace = page.getByRole('treeitem').first() + await workspace.waitFor() + if (await workspace.getAttribute('aria-expanded') !== 'true') await workspace.click() + await page.locator(`[data-row-key="session:${id}"]`).click() + + const relative = page.getByRole('button', { name: 'Relative colon:24–30', exact: true }) + await relative.waitFor() + await compareOrRefreshGolden( + fileURLToPath(new URL('./expected/markdown-colon-file-links.md', import.meta.url)), + await relative.locator('..').ariaSnapshot(), MODE, + ) + const column = page.locator('[data-rightbar-col]') + for (const [label, line] of [['Relative colon:24–30', 24], ['Absolute colon:30', 30], ['Fragment:12', 12]] as const) { + const link = page.getByRole('button', { name: label, exact: true }) + await link.focus() + await link.press('Enter') + await expect.poll(() => column.locator(`[data-textpreview-target="${line}"]`).textContent()) + .toBe(`source line ${line}\n`) + await expect.poll(() => column.locator('[data-textpreview-path]').textContent()) + .toBe(join(scaffold.workspaceCwd, 'src/example.txt')) + expect(await column.locator('[data-dockkit-tab-title]').allTextContents()).toEqual(['example.txt']) + } + await page.reload({ waitUntil: 'load' }) + await expect.poll(() => column.locator('[data-textpreview-path]').textContent()) + .toBe(join(scaffold.workspaceCwd, 'src/example.txt')) + await relative.click() + await expect.poll(() => column.locator('[data-textpreview-target="24"]').textContent()).toBe('source line 24\n') + expect(await column.locator('[data-dockkit-tab-title]').allTextContents()).toEqual(['example.txt']) + expect(tripwire.pageErrors).toEqual([]) + expect(tripwire.warnings).toEqual([]) + }) + it('opens parent-path prose and read-card links while retaining each address across reload', async () => { onTestFailed(() => saveFailureShot(page, 'web-e2e-parent-file-links')) // Return through the parent into this owned temp root; no shared parent file is created. diff --git a/docs/upgrade-guide/v0.2.1-rc.3/markdown-file-line-suffix/guide.i18n.yaml b/docs/upgrade-guide/v0.2.1-rc.3/markdown-file-line-suffix/guide.i18n.yaml new file mode 100644 index 0000000000..787fe3b9ac --- /dev/null +++ b/docs/upgrade-guide/v0.2.1-rc.3/markdown-file-line-suffix/guide.i18n.yaml @@ -0,0 +1,16 @@ +# Bilingual-pair consistency record for guide.md (docs/i18n/README.md): per heading +# section, a hash of its English and Chinese blocks outside code blocks and generated regions. +# After editing either side, bring the other along and re-record with: +# pnpm run verify-translation-pairing --write docs/upgrade-guide/v0.2.1-rc.3/markdown-file-line-suffix/guide.md +/: + en: 266987fe52b8ab15 + zh: 4d79714a0216646b +/numeric-suffixes-in-markdown-file-links: + en: f38f4cfc417f3c64 + zh: 627aaf7343f01dc8 +/numeric-suffixes-in-markdown-file-links/change: + en: 887230d85dab7f1e + zh: 0568278d811fb14c +/numeric-suffixes-in-markdown-file-links/migration: + en: 7264d29052dff23e + zh: 2114eb2037f3ede0 diff --git a/docs/upgrade-guide/v0.2.1-rc.3/markdown-file-line-suffix/guide.md b/docs/upgrade-guide/v0.2.1-rc.3/markdown-file-line-suffix/guide.md new file mode 100644 index 0000000000..6e43f7225b --- /dev/null +++ b/docs/upgrade-guide/v0.2.1-rc.3/markdown-file-line-suffix/guide.md @@ -0,0 +1,17 @@ +--- +kind: upgrade-guide +description: "Markdown file links interpret trailing colon numbers as line locations." +--- + +# Numeric suffixes in Markdown file links + +English | [中文](guide.zh.md) + +## Change + +Local Markdown destinations ending in `:24` or `:24-30` now open the file before that suffix at line 24. Previously, the suffix was part of the filename. Links to files whose names literally end with a colon and numbers need escaping. Destinations with a `#L24` fragment keep their existing interpretation. + +## Migration + +1. When linking a filename such as `notes:24`, encode its literal colon: `[notes](./notes%3A24)`. For a line reference, use `[notes:24](./notes:24)` or `[notes:24](./notes#L24)`. +2. Click the link in a settled message and confirm the preview opens the intended filename and line. diff --git a/docs/upgrade-guide/v0.2.1-rc.3/markdown-file-line-suffix/guide.zh.md b/docs/upgrade-guide/v0.2.1-rc.3/markdown-file-line-suffix/guide.zh.md new file mode 100644 index 0000000000..88266fc9ad --- /dev/null +++ b/docs/upgrade-guide/v0.2.1-rc.3/markdown-file-line-suffix/guide.zh.md @@ -0,0 +1,17 @@ +--- +kind: upgrade-guide +description: "Markdown 文件链接将末尾的冒号数字解释为行号定位。" +--- + +# Markdown 文件链接中的数字后缀 + +[English](guide.md) | 中文 + +## 变更 + +以 `:24` 或 `:24-30` 结尾的本地 Markdown 目标现在会打开后缀之前的文件并定位到第 24 行。此前,后缀属于文件名。链接到名称确实以冒号加数字结尾的文件时需要转义。带有 `#L24` 片段的目标保持原有解释方式。 + +## 迁移 + +1. 链接到 `notes:24` 这样的文件名时,将字面冒号编码:`[notes](./notes%3A24)`。引用行号时,使用 `[notes:24](./notes:24)` 或 `[notes:24](./notes#L24)`。 +2. 在已完成的消息中点击链接,确认预览打开预期的文件名和行号。 diff --git a/packages/client/ui-primitives/README.i18n.yaml b/packages/client/ui-primitives/README.i18n.yaml index 2e00fb223d..8818f029d2 100644 --- a/packages/client/ui-primitives/README.i18n.yaml +++ b/packages/client/ui-primitives/README.i18n.yaml @@ -24,8 +24,8 @@ en: b3744373b4b2c1fb zh: 2dbde8ee0bfa5f28 /deepseek-ai-dsh-client-ui-primitives/use-this-package/rendering-agent-output: - en: 31ed1a6239427512 - zh: cb489d77de109d3f + en: 4773b05fee4fb5a0 + zh: ac0862b6ab6bbd43 /deepseek-ai-dsh-client-ui-primitives/use-this-package/localizing-copy: en: a943603b74080ef5 zh: 43f7a0188aff271b diff --git a/packages/client/ui-primitives/README.md b/packages/client/ui-primitives/README.md index 380ce75142..1bf7649503 100644 --- a/packages/client/ui-primitives/README.md +++ b/packages/client/ui-primitives/README.md @@ -108,7 +108,7 @@ The catalog above lists what each export is for; this section covers the behavio The pure Markdown helper `formatQuoteText` normalizes CRLF and CR line endings, then prefixes each line with `> `. -The nearest `MarkdownDelegateProvider` supplies optional `openExternalLink` and `openFile` navigation callbacks. Nested providers replace the enclosing capabilities, and callback changes reach already-rendered links without rebuilding Markdown. Its `openFile` makes local Markdown links clickable after settlement. Absolute and workspace-relative paths support percent escapes and `#L24` / `#L24-L30` fragments; ranges open at their first line. Literal `?` and `#` in filenames must be percent-encoded. The tooltip uses the decoded path and supplies the accessible name when the label is empty. The callback receives the decoded path and optional line, while the renderer preserves the label and displays a file icon. Without a callback, local links remain text. URL schemes, queries, unsupported fragments, and malformed destinations never reach the file opener. +The nearest `MarkdownDelegateProvider` supplies optional `openExternalLink` and `openFile` navigation callbacks. Nested providers replace the enclosing capabilities, and callback changes reach already-rendered links without rebuilding Markdown. Its `openFile` makes local Markdown links clickable after settlement. Absolute and workspace-relative paths support percent escapes and `#L24` / `#L24-L30` fragments or `:24` / `:24-30` suffixes; ranges open at their first line. A fragment disables suffix parsing. Literal `?`, `#`, and a colon introducing a numeric suffix in filenames must be percent-encoded (`%3A` for the colon). The tooltip uses the decoded path and supplies the accessible name when the label is empty. The callback receives the decoded path and optional line, while the renderer preserves the label and displays a file icon. Without a callback, local links remain text. URL schemes, queries, unsupported fragments, and malformed destinations never reach the file opener. `MarkdownText` renders untrusted GFM and TeX math, blocks unsafe links and images, and can turn resolved file mentions into explicit controls. Strikethrough requires `~~`; a single `~`, as in `10~20`, stays literal. A surrounding `MarkdownDelegateProvider` receives sanitized HTTP(S) URLs from ordinary clicks; modified clicks and links outside a provider retain native external-anchor behavior. `omitHtml` renders raw HTML as nothing instead of literal text, for documents written for HTML renderers. When the owner passes a `pathImages` vocabulary, image destinations that are local media paths rewrite to displayable URLs on settled renders only (the same streaming gate as file mentions); without a vocabulary, local destinations remain inert alt text. Rewritten images accept HTTP(S), data, blob, and the Desktop `dsh-app://app/api/file`, `dsh-app://app/api/plugin-market/detail-file`, and `dsh-app://app/api/plugin-manager/detail-file` routes; authored Desktop URLs remain inert. A load or decode failure replaces the image with its authored alt text, or the original destination when alt is empty; `fileImages` additionally supplies a localized failure prefix. Changing the image source permits a fresh load. Each mounted image appends a `load` query parameter to a resolved Host `api/file` URL, because browsers reuse a same-URL image within one document despite `no-store`; a newly rendered image of an overwritten file therefore loads its current bytes, and every remount requests the file again; the Host file route redirects that request to a cacheable URL for the current file version. While a reply streams, it freezes completed blocks, advances a top-level open fence by completed lines, and highlights that fence from saved Shiki grammar state. Completed token lines enter fixed-size React groups, so later chunks reconcile only the growing group; an unchanged fence retains that DOM when the final full parse resolves cross-document syntax. `TerminalBlock`, `ReadBlock`, `DiffBlock`, `SearchBlock`, and `WebBlock` render the matching tool-result intent with copy controls, overflow handling, and ANSI processing where applicable. `JsonTree` and `JsonBlock` inspect JSON values read-only, while `UserTextRun` renders uninterpreted text and `ReferenceChip` renders business-resolved labels. An explicit `onActivate` makes a chip a keyboard-accessible button; repeated pointer clicks and an existing text selection do not activate it, while keyboard activation remains available. Labels inherit their host’s wrapping policy. Recognition and JSON transforms belong to [ui-conversation](../ui-conversation/README.md#sent-user-text). diff --git a/packages/client/ui-primitives/README.zh.md b/packages/client/ui-primitives/README.zh.md index 9d2ffe3698..777057ecf1 100644 --- a/packages/client/ui-primitives/README.zh.md +++ b/packages/client/ui-primitives/README.zh.md @@ -108,7 +108,7 @@ kind: "package-library" 纯 Markdown 工具 `formatQuoteText` 规范化 CRLF 和 CR 换行符,再为每行添加 `> ` 前缀。 -最近的 `MarkdownDelegateProvider` 提供可选的 `openExternalLink` 和 `openFile` 导航回调。嵌套 Provider 替换外层能力,回调变化无需重新构建 Markdown 即可到达已渲染链接。其 `openFile` 使本地 Markdown 链接在落定后可点击。绝对路径和工作区相对路径支持百分号转义以及 `#L24` / `#L24-L30` 片段;范围定位到起始行。文件名中的字面 `?` 和 `#` 必须百分号编码。悬停提示使用解码后的路径,并在标签为空时提供可访问名称。回调接收解码后的路径和可选行号,渲染器保留标签并显示文件图标。不传回调时,本地链接仍为文本。URL 协议、查询串、不支持的片段及格式错误的目标不会传给文件打开器。 +最近的 `MarkdownDelegateProvider` 提供可选的 `openExternalLink` 和 `openFile` 导航回调。嵌套 Provider 替换外层能力,回调变化无需重新构建 Markdown 即可到达已渲染链接。其 `openFile` 使本地 Markdown 链接在落定后可点击。绝对路径和工作区相对路径支持百分号转义以及 `#L24` / `#L24-L30` 片段或 `:24` / `:24-30` 后缀;范围定位到起始行。有片段时不解析后缀。文件名中的字面 `?`、`#` 以及引出数字后缀的冒号必须百分号编码(冒号用 `%3A`)。悬停提示使用解码后的路径,并在标签为空时提供可访问名称。回调接收解码后的路径和可选行号,渲染器保留标签并显示文件图标。不传回调时,本地链接仍为文本。URL 协议、查询串、不支持的片段及格式错误的目标不会传给文件打开器。 `MarkdownText` 渲染不可信的 GFM 与 TeX 公式、阻止不安全的链接与图片,并可把已解析的文件提及转换为显式控件。删除线需要 `~~`;单个 `~`(如 `10~20`)保持字面文本。外层 `MarkdownDelegateProvider` 会接收普通点击产生的已净化 HTTP(S) URL;带修饰键的点击和 Provider 外的链接保留原生外部 anchor 行为。`omitHtml` 不渲染原始 HTML,而不是将其显示为原样文本,用于为 HTML 渲染器编写的文档。当 owner 传入 `pathImages` 词表时,本地媒体路径的图片目标只在落定渲染阶段重写为可展示 URL(与 file mentions 相同的流式门);不传词表时本地目标保持惰性 alt 文本。重写后的图片支持 HTTP(S)、data、blob 及桌面端 `dsh-app://app/api/file`、`dsh-app://app/api/plugin-market/detail-file` 与 `dsh-app://app/api/plugin-manager/detail-file` 路由;正文直接书写的桌面端 URL 仍保持惰性。加载或解码失败后,图片替换为作者的 alt 文本;alt 为空时显示原始目标路径;`fileImages` 还提供本地化的失败提示前缀。图片源变化后可重新加载。每个挂载的图片会为解析得到的 Host `api/file` 地址追加 `load` 查询参数,因为浏览器在同一文档内会无视 `no-store` 复用相同 URL 的图片;因此覆盖后的文件在新渲染的图片中会加载当前内容,每次重新挂载都会重新请求该文件;Host 文件路由会把该请求重定向到当前文件版本的可缓存地址。回复流式输出时,它冻结已完成的块、按已完成行推进顶层未闭合 fence,并从保存的 Shiki grammar state 为该 fence 增量高亮。已完成的 token 行进入固定大小的 React 分组,后续分片只 reconcile 正在增长的分组;最终全量解析解决跨文档语法时,未变化的 fence 会保留该 DOM。`TerminalBlock`、`ReadBlock`、`DiffBlock`、`SearchBlock` 与 `WebBlock` 把对应的工具结果意图渲染为带复制控件、溢出处理及适用时 ANSI 处理的卡片。`JsonTree` 与 `JsonBlock` 以只读方式检查 JSON 值;`UserTextRun` 渲染不做解析的文本,`ReferenceChip` 渲染业务已解析的标签。显式传入 `onActivate` 后,胶囊成为可由键盘操作的按钮;重复指针点击和已有文本选区不触发激活,键盘激活仍然可用。标签继承所属容器的换行规则。识别和 JSON 变换由 [ui-conversation](../ui-conversation/README.zh.md#sent-user-text) 负责。 diff --git a/packages/client/ui-primitives/src/markdown/file-link.ts b/packages/client/ui-primitives/src/markdown/file-link.ts index bb1ca89b0b..9e9b7e8a90 100644 --- a/packages/client/ui-primitives/src/markdown/file-link.ts +++ b/packages/client/ui-primitives/src/markdown/file-link.ts @@ -1,16 +1,19 @@ /** Local Markdown destinations accepted by the file-preview callback. */ /** - * Decode a file destination and its optional GitHub-style line fragment. - * Literal `?` and `#` in filenames must be percent-encoded. + * Decode a file destination with a GitHub-style fragment or colon line suffix. + * A fragment takes precedence over suffix parsing. Percent-encode literal `?`, + * `#`, and a colon that would otherwise introduce a numeric line suffix. * @param value - Parsed Markdown link destination. * @returns A local path and optional first line, or undefined for URLs, * fragment-only links, queries, malformed escapes, or invalid line ranges. */ export function parseFileLink(value: string): { path: string; line?: number } | undefined { const hash = value.indexOf('#') - const destination = hash < 0 ? value : value.slice(0, hash) + let destination = hash < 0 ? value : value.slice(0, hash) if (destination.includes('?')) return undefined + const suffix = hash < 0 ? /:(\d+)(?:-(\d+))?$/.exec(destination) : null + if (suffix !== null) destination = destination.slice(0, suffix.index) let path: string try { path = decodeURIComponent(destination) @@ -21,12 +24,11 @@ export function parseFileLink(value: string): { path: string; line?: number } | if (path.length === 0 || /[\u0000-\u001f\u007f]/.test(path) || /^[\\/]{2}/.test(path) || (/^[a-z][a-z\d+.-]*:/i.test(path) && !/^[a-z]:[\\/]/i.test(path))) return undefined - if (hash < 0) return { path } - const fragment = value.slice(hash + 1) - const match = /^L([1-9]\d*)(?:-L([1-9]\d*))?$/.exec(fragment) + if (hash < 0 && suffix === null) return { path } + const match = suffix ?? /^L([1-9]\d*)(?:-L([1-9]\d*))?$/.exec(value.slice(hash + 1)) if (match === null) return undefined const line = Number(match[1]) const end = match[2] === undefined ? line : Number(match[2]) - if (!Number.isSafeInteger(line) || !Number.isSafeInteger(end) || end < line) return undefined + if (!Number.isSafeInteger(line) || !Number.isSafeInteger(end) || line < 1 || end < line) return undefined return { path, line } } diff --git a/packages/client/ui-primitives/tests/markdown-file-links.client.spec.tsx b/packages/client/ui-primitives/tests/markdown-file-links.client.spec.tsx index a4c0536885..e8b4d708e4 100644 --- a/packages/client/ui-primitives/tests/markdown-file-links.client.spec.tsx +++ b/packages/client/ui-primitives/tests/markdown-file-links.client.spec.tsx @@ -9,6 +9,17 @@ afterEach(cleanup) describe('Markdown file links', () => { it.each([ ['src/index.ts', 'src/index.ts', undefined], + ['src/index.ts:24', 'src/index.ts', { line: 24 }], + ['/workspace/src/index.ts:24', '/workspace/src/index.ts', { line: 24 }], + ['index.ts:24', 'index.ts', { line: 24 }], + ['./README:24', './README', { line: 24 }], + ['../docs/My%20Notes.md:24-30', '../docs/My Notes.md', { line: 24 }], + ['C:/work/file.ts:2', 'C:/work/file.ts', { line: 2 }], + ['C:%5Cwork%5Cfile.ts:2-3', 'C:\\work\\file.ts', { line: 2 }], + ['docs/notes%3A24', 'docs/notes:24', undefined], + ['docs/notes%3A24:30', 'docs/notes:24', { line: 30 }], + ['docs/notes:24#L3', 'docs/notes:24', { line: 3 }], + ['docs/notes:review', 'docs/notes:review', undefined], ['/workspace/src/index.ts#L24', '/workspace/src/index.ts', { line: 24 }], ['../docs/My%20Notes.md#L24-L30', '../docs/My Notes.md', { line: 24 }], ['C:/work/file.ts#L2', 'C:/work/file.ts', { line: 2 }], @@ -83,6 +94,9 @@ describe('Markdown file links', () => { '//example.com/file', '%2F%2Fexample.com/file', '%5C%5Cserver%5Cfile', 'javascript:alert', 'data:text/plain,hi', 'file:///etc/passwd', 'vscode:open', '%6Aavascript:alert', '#L2', 'file.ts?raw=1', 'file%ZZ.ts', 'file%00.ts', + '/file.ts:0', '/file.ts:3-2', '/file.ts:1-0', ':24', + '/file.ts:9007199254740992', '/file.ts:1-9007199254740992', + 'javascript:alert:24', 'file:///etc/passwd:24', '//example.com/file:24', 'file.ts#heading', 'file.ts#L0', 'file.ts#L3-L2', 'file.ts#L9007199254740992', 'file.ts#L1-L9007199254740992', ])('keeps unsupported destination %s inert', (target) => {