bamonroe / rnoweb-nvim

A neovim plugin for rnoweb files
MIT License
19 stars 3 forks source link

Treesitter overwrites rnoweb-nvim concealing? #4

Open life00 opened 7 months ago

life00 commented 7 months ago

Cool project. I was wondering if its possible to use this plugin in markdown environment for inline $ $ and code blocks $$ $$ of LaTeX. I tried but it doesn't seem to work, even though treesitter correctly renders the LaTeX syntax highlighting.

Also I had issues with using this plugin in LaTeX without additional_vim_regex_highlighting = { "latex"}, or disable = { "latex" },, but in markdown I need treesitter to fully be enabled otherwise the syntax highlighting completely breaks for some reason.

Any suggestions?

bamonroe commented 7 months ago

Hi, thanks. This plugin is only for rnoweb files, since it's mostly a personal project and that's the file format I use. It would not be difficult to make the plugin you describe for markdown using this plugin as a template if you were up for it.

Both rnoweb files and markdown files have multiple languages in them. These multiple languages need to have a treesitter parser that recognizes the parts of the text that apply to both languages. Then, in a neovim plugin, you need to traverse each language present and independently handle how you want to deal with it. You can look at the lua code to see how I've done it with rnoweb files.

Since this plugin is for rnoweb files, it only handles r and latex code blocks and has no support for markdown (and I have no plans on including it at the moment as I don't use markdown). Always happy to accept working pull requests if you wanted to extend the current code.

Could you give more details about what issues you had with latex only documents as that should be fully supported?

life00 commented 7 months ago

Thanks for quick response. Yeah I understand, I will take a look at the code and in case I will get something working I'll make a PR. Regarding the issue I had with LaTeX documents, I really don't understand how it works in background, but I imagine that treesitter overwrites rnoweb-nvim when additional_vim_regex_highlighting = { "latex" }, or disable = { "latex" }, is not set. I may provide additional logs if necessary, just tell me where. I use lazyvim.