neovim/tree-sitter-vimdoc

embedded languages in codeblocks

clason opened this issue · 5 comments

This is a moonshot, but would it be possible (at least in principle) to detect the language of a code_block? In contrast to Markdown, Vimdoc doesn't use language markers, so it's nigh impossible to set up proper injections for them. At least being able to distinguish Lua/Vimscript/Other (the last highlighted as plain string) would be great.

Proposal from #16:

Support lua> and vim> as injected code-block markers and add these to https://github.com/neovim/neovim/blob/cfdc93e8ac3e6c1577f1582c4b9546c118aa7987/runtime/syntax/help.vim#L18

Then we can use these markers in our help files and users on legacy syntax won't see a difference while tree-sitter can highlight them accordingly.

(or >lua, to have some parallel with Markdown syntax?)

I lean towards keep the > as the last thing on the line, to avoid forking vimdoc syntax where possible (gracefully degrades).

I think we want to add this to the syntax file anyway, to conceal the language annotation? (But I prefer lua> as well.)

Related (since I just noticed this in the README): line-modeline could inject the viml language.