Skip to content

Fix: Conflict between backlinks and LaTeX brackets due to ripgrep command #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

v3natio
Copy link

@v3natio v3natio commented Apr 3, 2025

Fix for #37

I added an implementation of the treesitter helper I use for my snippets.

Essentially it just leverages the treesitter nodes to detect whether we're in math mode (where the parent node is enclosed by $ or $$), or in text mode.

Then, I modified the find_search_start function so that it won't run if we're in math mode.

The only issue now, which I need some help for, is that whenever I have inbalanced braces within mathmode, then the treesitter helper will default back to textmode, and we run back into the issue we were trying to fix. For example:

$$
\begin{flalign*}
  &\left[ d_{d \right] &&\\
\end{flalign*}
$$

This is still better than the original, as before it would return the error even when braces were balanced.

@v3natio
Copy link
Author

v3natio commented Apr 3, 2025

Also, I decided that the best course of action would be to use treesitter, as string manipulation within the find_search_start function wouldn't be proper due to the use of display mode for math (where the $ signs are not in the same line as the math).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant