microsoft / microsoft/vscode

Markdown headings are not recognized after fenced code block containing "kotlin" in VS Code 1.126.0 (macOS)

Open
#324,442 2 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

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

---

* VS Code Version: 1.126.0
* OS Version: macOS

---

# Steps to Reproduce:

1. Create a new Markdown file
2. Paste the following content:

````markdown id="r7k2qx"
# A

```kotlin
"kotlin"
```

# B
````

3. Open Outline view or observe Markdown heading parsing in the editor

---

# Expected Behavior:

* Both `# A` and `# B` should be recognized as Markdown headings
* Outline view should display both headings
* Markdown structure should remain intact regardless of fenced code block content

---

# Actual Behavior:

* `# A` is recognized correctly
* `# B` is NOT recognized as a heading
* Markdown parsing appears to break after a fenced code block containing the string `"kotlin"`
* The issue affects editor-level Markdown structure (e.g. Outline / symbol navigation), while plain text rendering remains visible

---

# Additional Information:

The issue is reproducible even with all extensions disabled.

It occurs with multiple fenced code block languages:

````markdown id="3v9pwm"
```text
"kotlin"
```
````

````markdown id="q8m2ld"
```foobar
"kotlin"
```
````

However, the issue only appears when the exact string `"kotlin"` is present inside the fenced code block. Other strings (e.g. `"java"`, `"abc"`, `"hello"`) do not trigger the issue.

This suggests a Markdown editor tokenization/state machine regression in VS Code 1.126.0 where specific string content inside fenced code blocks causes incorrect parsing of subsequent Markdown structure.

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.