Skip to content

fix(web): open Windows markdown file links - #4545

Open
glowdotjpeg wants to merge 1 commit into
pingdotgg:mainfrom
glowdotjpeg:fix/clickable-markdown-file-links
Open

fix(web): open Windows markdown file links#4545
glowdotjpeg wants to merge 1 commit into
pingdotgg:mainfrom
glowdotjpeg:fix/clickable-markdown-file-links

Conversation

@glowdotjpeg

@glowdotjpeg glowdotjpeg commented Jul 25, 2026

Copy link
Copy Markdown

What Changed

  • Preserve recognized filesystem paths through Markdown URL sanitization.
  • Recover raw Windows file destinations when React Markdown strips backslashes.
  • Render these references using T3 Code's existing file-link chip and file panel.
  • Add coverage for Windows paths, encoded paths, paths containing spaces, and unsafe schemes.

Why

Codex can emit file links using Windows paths, for example:

[AVA_HANDOFF.md]
(C:\Users\name\project\AVA_HANDOFF.md)

React Markdown can sanitize or alter these destinations before the anchor renderer receives them. The result is a blue link that has no href and does nothing when clicked.

This change recovers and validates the original filesystem destination, then routes it through T3 Code's existing file-reference UI.

External URL schemes continue to use the normal URL sanitizer.

UI Changes

Before: sometimes, the filename would appear as an inert blue link.
image

After: it renders as T3 Code's native file chip and opens the file in the right-side panel.
image

Verification

  • vp test run src/markdown-links.test.ts --project unit — 24 tests passed
  • vp run typecheck
  • Focused lint
  • Verified the Windows-style link opens the correct file in an isolated T3 Code environment

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for the UI change
  • I included a video for animation/interaction changes — not applicable

Note

Low Risk
Scoped to chat markdown link parsing and sanitization; external URLs still use the default sanitizer and unsafe schemes are explicitly rejected in tests.

Overview
Fixes inert blue links when chat markdown uses Windows-style file paths (e.g. C:\Users\...\file.md) that React Markdown sanitizes or mangles before rendering.

markdown-links adds helpers to keep recognized filesystem paths through URL sanitization (preserveMarkdownFileLinkHref), normalize file href keys (normalizeMarkdownFileLinkHref), and re-read the raw destination from the source markdown via AST offsets (extractMarkdownLinkDestinationAtOffsets) when the parsed href loses backslashes or encoding.

ChatMarkdown wires urlTransform to preserve validated file paths (still falling back to defaultUrlTransform for real URLs), resolves file-link metadata from both sanitized and recovered hrefs, and uses the source destination for copy-to-clipboard markdown. File links continue to render as the native file chip and open in the side panel.

New unit tests cover Windows paths, spaces, angle-bracket destinations, encoded hrefs, and rejection of unsafe schemes like javascript:.

Reviewed by Cursor Bugbot for commit 165116b. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix markdown file link resolution for Windows paths in ChatMarkdown

  • Adds extractMarkdownLinkDestinationAtOffsets to markdown-links.ts to recover raw link destinations (including Windows-style paths and space-containing paths) from parsed node offsets.
  • Adds preserveMarkdownFileLinkHref and normalizeMarkdownFileLinkHref to normalize and validate file link hrefs against the workspace or filesystem before React Markdown sanitizes them.
  • Updates ChatMarkdown.tsx to resolve file link metadata using both the sanitized href and the raw source destination, so Windows paths and space-containing paths are matched correctly.
  • Behavioral Change: the URL transform now bypasses React Markdown's default sanitization for hrefs that resolve to workspace or filesystem targets; external schemes remain sanitized.

Macroscope summarized 165116b.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1252fac7-613f-4485-8cbb-02883a02bf42

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Jul 25, 2026
@macroscopeapp

macroscopeapp Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR adds custom markdown parsing logic and modifies URL sanitization behavior for Windows file paths. As a first-time contributor's change to URL transformation logic, human review is recommended to verify edge cases and security considerations.

You can customize Macroscope's approvability policy. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant