Closed xfzv closed 3 months ago
Since the filetype
gets overridden to fstab
and there is no parser defined by treesitter for this filetype I wouldn't expect it to work. This type of setup creates 2 FileType
events, the first one for markdown causes this plugin to attempt to parse the file. However when we later attempt to get the parser, treesitter only picks up the fstab
filetype and fails.
I have pushed a fix to avoid errors in these cases: https://github.com/MeanderingProgrammer/markdown.nvim/commit/ddb454792dd85c0f6039ec14006aecaee67e782d.
So at least it won't break but it also won't do any rendering, effectively becomes a no-op. If you want this plugin to render fstab
as it would markdown
you'll need to add the following somewhere in your config:
vim.treesitter.language.register('markdown', 'fstab')
Which tells treesitter to parse fstab
files as if they were markdown
. Similar for all other filetypes you want to treat as markdown
. This will change the highlighting behavior for all of these filetypes.
Thank you for the detailed explanation!
Neovim version (nvim -v)
Operating system
Linux
Terminal emulator / GUI
kitty 0.35.2
Describe the bug
I have a markdown file with a code block containing
# vim: ft=fstab
(which is a valid file type). This triggers the following error when opening said markdown file withmarkdown.nvim
enabled:To reproduce:
# vim: ft=fstab
(also occurs with# vim: ft=zzz
for example) in a code block of a new markdown filemarkdown.nvim
enabledExpected behavior
No error.
Healthcheck output
Plugin configuration
Confirmations
Additional information
No response