Good enough syntax highlight for MDX in Neovim using Treesitter.
Highlight support for mdx based in the post written by Phelipe Teles.
With lazy.nvim
{
"davidmh/mdx.nvim",
dependencies = {"nvim-treesitter/nvim-treesitter"}
}To test the plugin with a minimal configuration:
# Run the setup script to install plugins and parsers
./setup-minimal-config
# Open the test file
nvim -u minimal-init.lua test.mdxThis will:
- Install lazy.nvim, nvim-treesitter and mdx.nvim
- Install treesitter parsers for markdown, tsx, and typescript
The test file test.mdx contains example MDX code to verify syntax highlighting works correctly.
With vim-plug
Plug 'nvim-treesitter/nvim-treesitter'
Plug 'davidmh/mdx.nvim'With NvChad
From the NvChad docs:
All NvChad default plugins will have
lazy = trueset. Therefore, if you want a plugin to be enabled on startup, change it tolazy = false.
Since this plugin only defines a filetype it's safe to let it run on startup.
So setting lazy = false is enough.
But if you absolutely need to loaded only when needed, you can use event = "BufEnter *.mdx"