When this extension is enabled, its Markdown grammar injection also runs inside fenced code blocks. Markdown-looking characters can then override the embedded language grammar and corrupt highlighting until the closing fence.
This happens while the editor language mode is regular markdown (not mdc).
Repro
With nuxt.mdc 0.6.2 enabled, open a Markdown file containing:
Example
```powershell
icacls $KEY_PATH /remove:g '*S-1-5-11' '*S-1-5-32-545' '*S-1-1-0'
icacls $KEY_PATH /grant:r "${me}:R"
```
Example
Make sure the editor language mode is Markdown.
Starting at the first *, the PowerShell content receives markup.italic.markdown. The scope remains open across the next line, PowerShell tokenization is corrupted, and normal highlighting resumes only at the closing fence.
Developer: Inspect Editor Tokens and Scopes shows scopes:
markup.italic.markdown
string.quoted.single.powershell
meta.embedded.block.powershell
markup.fenced_code.block.markdown
meta.embedded.block.markdown
markup.fenced_code.block.markdown
text.html.markdown
Expected scopes:
string.quoted.single.powershell
meta.embedded.block.powershell
markup.fenced_code.block.markdown
meta.embedded.block.markdown
markup.fenced_code.block.markdown
text.html.markdown
Disabling this extension removes the incorrect scope.
Expected behavior
MDC/Markdown inline rules should not run inside fenced code blocks. Their contents should be tokenized only by the embedded language grammar.
Cause (AI inference)
The extension injects its grammar into regular Markdown. The injected grammar uses the broad selector L:text.html.markdown without excluding markup.fenced_code.block.markdown.
Its top-level #inline path also re-includes text.html.markdown#inline. This makes the standard Markdown italic rule compete with the embedded PowerShell grammar. Since the injection uses L:, its rules have priority over existing grammar rules.
This is broader than PowerShell: MDC attributes and bindings such as {foo} and {{ bar }} also receive MDC scopes inside recognized and unrecognized fenced code blocks.
In an isolated TextMate tokenization test:
- Excluding
markup.fenced_code.block.markdown from the injection selector prevents all MDC/Markdown scopes inside both recognized and unrecognized fences.
- Removing only the
text.html.markdown#inline inclusion prevents this italic reproduction, but still allows other MDC rules to leak into fenced code.
- Removing only
L: is not sufficient.
The exact reproduction tokenizes correctly with version 0.5.0. The top-level text.html.markdown#inline inclusion is present from 0.6.0 onward and remains present on the current main branch.
Environment
- VS Code: 1.126.0, arm64
- Extension:
nuxt.mdc 0.6.2
- Editor language mode: Markdown
- OS: macOS
When this extension is enabled, its Markdown grammar injection also runs inside fenced code blocks. Markdown-looking characters can then override the embedded language grammar and corrupt highlighting until the closing fence.
This happens while the editor language mode is regular
markdown(notmdc).Repro
With
nuxt.mdc0.6.2 enabled, open a Markdown file containing:Make sure the editor language mode is
Markdown.Starting at the first
*, the PowerShell content receivesmarkup.italic.markdown. The scope remains open across the next line, PowerShell tokenization is corrupted, and normal highlighting resumes only at the closing fence.Developer: Inspect Editor Tokens and Scopesshows scopes:Expected scopes:
Disabling this extension removes the incorrect scope.
Expected behavior
MDC/Markdown inline rules should not run inside fenced code blocks. Their contents should be tokenized only by the embedded language grammar.
Cause (AI inference)
Environment
nuxt.mdc0.6.2