# Markdown preview code link with line numbers not working

**URL:** <https://forum.cursor.com/t/markdown-preview-code-link-with-line-numbers-not-working/164074>\
**Category:** Bug Reports\
**Created:** [June 25, 2026, 12:07pm UTC](https://forum.cursor.com/t/markdown-preview-code-link-with-line-numbers-not-working/164074 "2026-06-25T12:07:21Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sabvente-gti](https://avatars.discourse-cdn.com/v4/letter/s/77aa72/32.png) [@sabvente-gti](https://forum.cursor.com/u/sabvente-gti)\
**Post date:** [June 25, 2026, 12:07pm UTC](https://forum.cursor.com/t/markdown-preview-code-link-with-line-numbers-not-working/164074/1 "2026-06-25T12:07:21Z")

</div>

### Where does the bug appear (feature/product)?

Cursor IDE

### Describe the Bug

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

```markdown
[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

```markdown
[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

---

<div class="post-metadata">

**Author:** ![deanrie](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/deanrie/32/1263_2.png) [@deanrie](https://forum.cursor.com/u/deanrie)\
**Post date:** [June 25, 2026, 12:38pm UTC](https://forum.cursor.com/t/markdown-preview-code-link-with-line-numbers-not-working/164074/5 "2026-06-25T12:38:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![soswow](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/soswow/32/113402_2.png) [@soswow](https://forum.cursor.com/u/soswow)\
**Post date:** [July 3, 2026, 11:35am UTC](https://forum.cursor.com/t/markdown-preview-code-link-with-line-numbers-not-working/164074/7 "2026-07-03T11:35:05Z")

</div>

> Only a single line anchor like `#L12` works.

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

```auto
(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

```auto
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.

---

<div class="post-metadata">

**Author:** ![deanrie](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/deanrie/32/1263_2.png) [@deanrie](https://forum.cursor.com/u/deanrie)\
**Post date:** [July 3, 2026, 1:49pm UTC](https://forum.cursor.com/t/markdown-preview-code-link-with-line-numbers-not-working/164074/8 "2026-07-03T13:49:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bombaclat](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@bombaclat](https://forum.cursor.com/u/bombaclat)\
**Post date:** [July 29, 2026, 11:51am UTC](https://forum.cursor.com/t/markdown-preview-code-link-with-line-numbers-not-working/164074/9 "2026-07-29T11:51:11Z")

</div>

@deanrie This bug with the Markdown anchors in Preview has still no resolution. All topics from March are already close via attaching either via “No posts for a X days”. Any ETA? How such important functionality couldn’t be working on Tier-1(?:0) Code Editor?

---

<div class="post-metadata">

**Author:** ![Artem7](https://avatars.discourse-cdn.com/v4/letter/a/34f0e0/32.png) [@Artem7](https://forum.cursor.com/u/Artem7)\
**Post date:** [September 20, 2026, 9:48am UTC](https://forum.cursor.com/t/markdown-preview-code-link-with-line-numbers-not-working/164074/12 "2026-09-20T09:48:50Z")

</div>

would love to see this fixed

---

<div class="post-metadata">

**Author:** ![deanrie](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/deanrie/32/1263_2.png) [@deanrie](https://forum.cursor.com/u/deanrie)\
**Post date:** [September 20, 2026, 12:13pm UTC](https://forum.cursor.com/t/markdown-preview-code-link-with-line-numbers-not-working/164074/13 "2026-09-20T12:13:47Z")

</div>

Hey, thanks for the heads up. I can see this is still relevant. We’re still tracking the issue, but I can’t share an ETA for a fix yet. As soon as I have an update, I’ll reply in this thread.

For now, the workaround is the same: to jump to a line, use the built-in preview Command Palette → Markdown: Open Preview or `Ctrl+Shift+V`. It parses the path and `#fragment` correctly, and a single-line anchor like `#L3207` will open the file on the right line. In Preview toggle, links with `#fragment` still don’t work. The range syntax `#L12-L15` isn’t supported in any preview.

---

<div class="post-metadata">

**Author:** ![orthemius](https://avatars.discourse-cdn.com/v4/letter/o/dec6dc/32.png) [@orthemius](https://forum.cursor.com/u/orthemius)\
**Post date:** [October 13, 2026, 4:20am UTC](https://forum.cursor.com/t/markdown-preview-code-link-with-line-numbers-not-working/164074/14 "2026-10-13T04:20:54Z")

</div>

Links to files in the project relative to the root do not work in the preview, while in the text with ctrl+click - everything works.  
Fix it finally!

Relative for .md + anchor [KonvIoMap.hpp](../Core/alg/Konv/KonvIoMap.hpp#L35) - doesnt work

Relative for project root + anchor [KonvIoMap.hpp](/Core/alg/Konv/KonvIoMap.hpp#L35) - doesnt work

Relative for .md [KonvIoMap.hpp](../Core/alg/Konv/KonvIoMap.hpp) - does work! the only one.

Relative for project root [KonvIoMap.hpp](/Core/alg/Konv/KonvIoMap.hpp) - doesnt work

---

<div class="post-metadata">

**Author:** ![deanrie](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/deanrie/32/1263_2.png) [@deanrie](https://forum.cursor.com/u/deanrie)\
**Post date:** [October 30, 2026, 4:51pm UTC](https://forum.cursor.com/t/markdown-preview-code-link-with-line-numbers-not-working/164074/15 "2026-10-30T16:51:00Z")

</div>

Hey, thanks for the detailed breakdown of the link variants. That really helps. I get that this has dragged on.

Links with `#L35` don’t open in Preview toggle. That’s the same issue from this thread, and we’re tracking it. I added your examples with `../` and `/` to it too. No timeline yet.

But `/Core/alg/Konv/KonvIoMap.hpp` from the project root, without an anchor, not opening in Preview looks like a separate issue. So we don’t mix it into this one, please create a separate thread in Bug Reports with that example, your Cursor version from Help \> About, and your OS.

For now, you can open docs through the built-in preview: Command Palette → `Markdown: Open Preview` or `Ctrl+Shift+V`. There, the path and `#fragment` are parsed correctly, and a single-line anchor like `#L35` should open the file on the right line. Please let me know if your project-root links work there too. That would help as well.

I’ll post in the thread when there’s an update.
