Markdown preview code link with line numbers not working

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

In markdown, I expect links like this work from the Preview view:

[import-body.js:12-15](import-body.js#L12-L15)

Steps to Reproduce

Create a file named import-body.js, enter some source code.

Create a new .md file.

Enter

[import-body.js:12-15](import-body.js#L12-L15)

Switch to “Preview” view.

Click on the link.

Cursor shows:
Unable to open ‘import-body.js’
The editor could not be opened because the file was not found.

Expected Behavior

To open the file focused at the specific lines.

Operating System

Windows 10/11

Version Information

Version: 3.8.11 (system setup)
VS Code Extension API: 1.105.1
Commit: e56ad3440df06d22ca7501e65fd518e905486ef0
Date: 2026-06-18T01:40:18.333Z
Layout: editor
Build Type: Stable
Release Track: Default
Electron: 40.10.3
Chromium: 144.0.7559.236
Node.js: 24.15.0
V8: 14.4.258.32-electron.0
xterm.js: 6.1.0-beta.256
OS: Windows_NT x64 10.0.26200

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the detailed report and steps. This is a confirmed bug on our side. In Cursor Preview, clicking a relative link with a #fragment anchor does not split the #... part from the path, so the file looks like it cannot be found. The issue is already tracked, but I can’t share an ETA for the fix yet.

A couple of workarounds for now:

  • A link without a fragment opens fine: [import-body.js](import-body.js).
  • If you need to jump to a specific line, use the built-in preview: Command Palette → Markdown: Open Preview or Ctrl+Shift+V. There the path and fragment are parsed correctly and the file opens.
  • Note that the GitHub range syntax #L12-L15 is not supported in any Markdown preview. Only a single line anchor like #L12 works.

Once there’s an update on the fix, I’ll reply in the thread.

Only a single line anchor like #L12 works.

That’s not true. I believe this whole therad is about that.

(e.g. [#L3207](source/blender/makesrna/intern/rna_object.cc#L3207)

that’s the code I have in .md file. Clicking it in Markdown view works. It follows the link and focuses on the line. Clicking this in Preview - doesn’t.

instead it throws

ERR V0: The editor could not be opened because the file was not found.
    at P_n.handleSetInputError (workbench.desktop.main.js:25084:37758)
    at async P_n.setInput (workbench.desktop.main.js:25084:36767)
    at async hhh.doSetInput (workbench.desktop.main.js:21277:195819)
    at async hhh.doOpenEditor (workbench.desktop.main.js:21277:193559)
    at async hhh.openEditor (workbench.desktop.main.js:21277:192484)
    at async workbench.desktop.main.js:21389:39428
    at async uwh.doOpenCodeEditor (workbench.desktop.main.js:24272:37819)
    at async uwh.openCodeEditor (workbench.desktop.main.js:24272:26742)
    at async y0h.open (workbench.desktop.main.js:24728:3373)
    at async w0h.open (workbench.desktop.main.js:24728:5666)
    at async cCk (workbench.desktop.main.js:20497:46033)

it’s rather annoying bug. I am using Cursor to explain me some things through .md
This bug prevents me from following links to code when I Am reading generated documentation. Reading Markdown view is obv. is not a great experience.

For now, my workaround would be - keeping VSCode open with their Preview since there is no bug there.

Hey, thanks for clarifying. This was a misunderstanding because there are two different kinds of Preview.

You’re right. In Cursor Preview (the one you switch with the Preview/Code toggle in the tab), links with #fragment don’t work at all. That includes both #L3207 and ranges like #L12-L15. That’s the bug. The #... fragment isn’t separated from the path, so the file “can’t be found”. There’s no difference between a single line and a range there.

What I said about #L12 working was about the other preview, the built-in Markdown preview. Open it via Command Palette → Markdown: Open Preview or Ctrl+Shift+V. It’s inside Cursor, so you don’t need a separate VS Code. In that preview, the path and fragment are parsed correctly, and a single anchor like #L3207 opens the file at the right line. Ranges like #L12-L15 aren’t supported anywhere, not in Cursor and not in VS Code. Only single-line anchors work.

So the workaround without using a separate VS Code is to read the docs via Ctrl+Shift+V, not via the Preview toggle.

The Preview toggle bug is known and tracked. There’s no ETA for a fix yet. I’ll post an update in the thread when there’s news.