microsoft / microsoft/vscode

Markdown editor (experimental): anchor links to headings do not navigate, in the same document or across files

Open
#331,624 0 comments 0 reactions 1 assignee Claimed by @hediet View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Type: Bug

Does this issue occur when all extensions are disabled?: Yes

- VS Code Version: 1.134.0 (110a328ea54b42367b803ec53ee0bf52ef26b419, x64)
- OS Version: Windows 11 Enterprise 10.0.26200

In the experimental Markdown editor, anchor links do not navigate. Any link carrying a `#fragment` renders normally and is clickable, but fails to move the view to the target heading, whether the anchor points at the same document or at another file. The fragment appears to be ignored.

Plain file links and external URLs work correctly in the same editor, so this is specific to fragments rather than to links in general. Every case below works correctly in Markdown Preview, so the anchors themselves are valid.

This affects long documents that open with a table of contents linking down to their own sections, and cross-document references into a specific section. Both are common shapes for plan and spec files.

Steps to Reproduce:

1. Save the two files at the bottom of this issue as `repro.md` and `other.md` in the same folder.
2. Open `repro.md` with Markdown Preview and click every link. All six behave as expected.
3. Reopen `repro.md` with Markdown Editor (Experimental), via right-click the tab, Reopen Editor With.
4. Click every link again.

Results in the experimental editor:

| Link | Result |
| --- | --- |
| `[a](#target-heading)` | Fails |
| `[a](repro.md#target-heading)` | Fails |
| `` | Fails |
| `[a](other.md#cross-file-target)` | Fails, see below |
| `[a](other.md)` | Works |
| `[a](https://code.visualstudio.com)` | Works |

For the three same-document cases, nothing happens at all. No scroll, no error, no notification. The pointer changes over the link and the click registers, but there is no navigation.

For the cross-file fragment, `other.md` opens but lands at the top of the file rather than at the "Cross file target" heading. So the link itself is handled and the fragment is dropped on arrival.


repro.md

```markdown
# Anchor repro

## Fragments, same document

1. [Bare fragment](#target-heading)
2. [Qualified fragment](repro.md#target-heading)
3.
HTML anchor

## Fragments, other document

1. [Other file with fragment](other.md#cross-file-target)

## Controls, no fragment

1. [Other file, no fragment](other.md)
2. [External URL](https://code.visualstudio.com)

## Filler

(30 lines of filler so the target is off screen)

## Target heading

If you can see this line without having scrolled by hand, the link worked.
```

other.md

```markdown
# Anchor repro target

## Filler

(30 lines of filler so the target is off screen)

## Cross file target

If you landed here without scrolling by hand, the cross-file fragment link worked.
```

VS Code version: Code 1.134.0 (110a328ea54b42367b803ec53ee0bf52ef26b419, 2026-08-18T18:24:44Z)
OS version: Windows_NT x64 10.0.26200
Modes:

System Info

|Item|Value|
|---|---|
|CPUs|13th Gen Intel(R) Core(TM) i9-13950HX (32 x 2419)|
|GPU Status|2d_canvas: enabled
GPU0: VENDOR= 0x10de, DEVICE=0x28b9 [NVIDIA RTX 1000 Ada Generation Laptop GPU], DRIVER_VENDOR=NVIDIA, DRIVER_VERSION=32.0.15.9595 *ACTIVE*
GPU1: VENDOR= 0x8086, DEVICE=0xa788 [Intel(R) UHD Graphics], DRIVER_VERSION=32.0.101.7085
GPU2: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.26100.8875
Machine model name:
Machine model version:
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgpu: enabled
webnn: disabled_off|
|Load (avg)|undefined|
|Memory (System)|15.55GB (2.11GB free)|
|Process Argv|--folder-uri file:///c%3A/d-workspace --crash-reporter-id 1a1d7d91-288e-4a01-81f7-beacc16ae0f2|
|Screen Reader|no|
|VM|0%|
Extensions (22)

Name|Identifier|Author|Version
---|---|---|---
Claude Code for VS Code|anthropic.claude-code|Anthropic|2.1.235
Office Viewer|cweijan.vscode-office|cweijan|4.2.0
markdownlint|davidanson.vscode-markdownlint|DavidAnson|0.62.1
DBCode - SQL & Database Client for Postgres, MySQL, MongoDB & more|dbcode.dbcode|dbcode|1.36.11
dbdiagram|dbdiagram.dbdiagram-vscode|dbdiagram|0.4.0
HTML CSS Support|ecmel.vscode-html-css|ecmel|2.0.14
HTML Preview|george-alisson.html-preview-vscode|george-alisson|0.2.5
HashiCorp Terraform|hashicorp.terraform|hashicorp|2.40.0
Draw.io Integration|hediet.vscode-drawio|hediet|1.9.0
Rainbow CSV|mechatroner.rainbow-csv|mechatroner|3.24.1
Container Tools|ms-azuretools.vscode-containers|ms-azuretools|2.4.5
Dev Containers|ms-vscode-remote.remote-containers|ms-vscode-remote|0.466.0
WSL|ms-vscode-remote.remote-wsl|ms-vscode-remote|0.104.3
PowerShell|ms-vscode.powershell|ms-vscode|2025.4.0
Paste Image|mushan.vscode-paste-image|mushan|1.0.4
Live Server|ritwickdey.liveserver|ritwickdey|5.7.10
Open Window Tab Context|takkao.open-window-tab-context|takkaO|1.12.0
vscode-pdf|tomoki1207.pdf|tomoki1207|1.2.2
Extension Pack for Java|vscjava.vscode-java-pack|vscjava|0.31.1
Video Player (with Audio) — MP4/MOV/WebM|yutabee.unmute-video|yutabee|0.2.5
Markdown PDF|yzane.markdown-pdf|yzane|2.2.0
Markdown All in One|yzhang.markdown-all-in-one|yzhang|3.6.3

A/B Experiments

```
permission_prompt_control:1332567
ccr_pr_nudge_auto_review:1319472

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.