Tree-sitter powered syntax highlighting for MyST Markdown in Neovim.
Code-cell directives, math blocks, and 10+ language injections.
# MyST Markdown Example
```{code-cell} python
import pandas as pd
df = pd.DataFrame({
"x": [1, 2, 3],
"y": [4, 5, 6]
})
print(df)
```
```{math}
\begin{aligned}
E &= mc^2 \\
F &= ma
\end{aligned}
```
Everything you need for MyST Markdown editing in Neovim
Automatically detects MyST files based on content patterns like {code-cell} and {math} directives.
Language-specific syntax highlighting inside {code-cell} directives โ Python, JavaScript, Bash, and more.
Full LaTeX syntax highlighting for {math} directives and $$ blocks.
Built on tree-sitter for robust, accurate parsing. Uses injection queries for language-specific highlighting.
Detection caching, configurable scan limits, and zero-cost debug logging when disabled.
Comprehensive test suite covering directives, edge cases, performance, and tree-sitter integration.
Get up and running in minutes
{
"QuantEcon/myst-markdown-tree-sitter.nvim",
version = "0.5.1",
dependencies = { "nvim-treesitter/nvim-treesitter" },
ft = { "markdown", "myst" },
config = function()
require('myst-markdown').setup()
end,
}
use {
'QuantEcon/myst-markdown-tree-sitter.nvim',
requires = {'nvim-treesitter/nvim-treesitter'},
config = function()
require('myst-markdown').setup()
end
}
:TSInstall markdown markdown_inline:TSInstall python latexWorks out of the box โ customize when you need to
require('myst-markdown').setup()
require('myst-markdown').setup({
debug = false,
detection = {
scan_lines = 50,
},
performance = {
cache_enabled = true,
},
highlighting = {
enabled = true,
},
})
| Option | Default | Description |
|---|---|---|
debug |
false |
Enable verbose debug logging |
detection.scan_lines |
50 |
Lines to scan for MyST patterns |
performance.cache_enabled |
true |
Cache filetype detection results |
highlighting.enabled |
true |
Enable tree-sitter highlighting |
Language injection for {code-cell} directives
Install parsers with :TSInstall <language>
Built-in commands for debugging and diagnostics
:MystStatusQuick health check of MyST highlighting status for the current buffer.
:MystDebugComprehensive debugging info โ tree-sitter state, queries, injections, diagnostics.
:MystInfoShow plugin version, configuration, and environment details.
Quick fixes for common issues
:MystStatus for a quick health check{code-cell} or {math}:MystDebug for detailed diagnosticsThe tree-sitter parser for that language may not be installed.
:TSInstall python -- or javascript, bash, etc.
Verify with :TSInstallInfo to see installed parsers.
If you have another MyST plugin installed (e.g., myst-markdown.nvim without tree-sitter in the name), remove it โ it can conflict with filetype detection and query injection.
Check via :scriptnames or :echo &runtimepath.
Install the LaTeX tree-sitter parser:
:TSInstall latex
MyST supports both backtick fences (```) and colon fences (:::), but this plugin only supports backtick fences because the underlying markdown tree-sitter parser doesn't recognize colon fences.
See issue #51 for tracking a dedicated MyST parser.