Skip to content

fix(chat): handle markdown link file paths in chat messages#51

Merged
bbsngg merged 2 commits intomainfrom
feat/chat-file-preview
Mar 20, 2026
Merged

fix(chat): handle markdown link file paths in chat messages#51
bbsngg merged 2 commits intomainfrom
feat/chat-file-preview

Conversation

@MarkSiqiZhang
Copy link
Copy Markdown
Collaborator

Summary

  • When AI (e.g. Codex) outputs file references as markdown links (e.g. [App.tsx:1](App.tsx#L1)), clicking them previously navigated the browser to a non-existent URL instead of opening the file in the editor panel
  • Added a component override in Markdown.tsx to detect file path hrefs and route them through onFileOpen
  • Strips URL fragments (e.g. #L1) before file path detection, since AI models often append line anchors to file paths

Test plan

  • Ask Codex to convert a .tex file to markdown — it will reference output files like background.zh.md as markdown links in its response
  • Verify clicking these links opens the file in the editor side panel, not navigating to a new browser page
  • Verify regular https:// links still open in a new tab as before
  • Verify inline code file paths (e.g. App.tsx in backticks) still work as before

@bbsngg bbsngg merged commit 131d8fb into main Mar 20, 2026
1 check passed
@bbsngg bbsngg deleted the feat/chat-file-preview branch March 20, 2026 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants