A Neovim plugin for Mermaid.js syntax highlighting using nvim-treesitter.
Install with your favorite plugin manager.
use {
'your-username/mermaidjs.nvim',
requires = {
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate'
},
config = function()
require('nvim-treesitter.configs').setup {
-- A list of parser names, or "all"
ensure_installed = { "mermaid" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
}
end,
}This plugin automatically highlights .mmd and .mermaid files.
After installing, you need to install the mermaid parser for nvim-treesitter.
Run the following command in Neovim:
:TSInstall mermaid
This will download and build the mermaid parser from the tree-sitter-mermaid repository.