Feature request: activate otter in LaTeX math blocks
Was wondering if it would be possible to activate otter when you are either in:
$$
...
$$
or
This is my equation:
\begin{...}
...
\begin{...}
Not yet, but a couple of days ago the markdown treesitter grammar got support for latex chunks (https://github.com/MDeiml/tree-sitter-markdown/commit/7e7aa9a25ca9729db9fe22912f8f47bdb403a979). This will make it straightforward to write a query to get the latex content. But in order to use that I will have to make some internal changes in https://github.com/jmbuhr/otter.nvim/blob/8b46caf113918c26a9247031d6482709078ec907/lua/otter/keeper.lua#L20 because right now it only supports one query per buffer and that captures both the language and the content (e.g. a code chunk in markdown).
That being said, if you are just after completion for math symbols I find that it is convenient to enable them for the whole document anyways, so there is not need for a separate treatment of math blocks. Here are some examples: https://www.youtube.com/watch?v=Lc_kMYVIS5I
This should be solved with the latest update that can use injections to find code chunks.
@jmbuhr do you have a sample configuration? I can't get this to work :/
from what I can see markdown_inline parser needs to be called for this, since the injections in the markdown parser only include code blocks
Indeed, I just realized that this doesn't currently work because the parser for the document is markdown, which itself injects the markdown-inline parser into blocks, which then can inject latex. However, otter currently doesn't support multiple levels of injections. This is a good use case to show why we might want this.
Does this also prevent fenced latex code blocks from working?
No, fenced code blocks should be only one level of injections, so it should work.