Skip to content
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

Distinguish block & inline equations #5

Open
Triton171 opened this issue Jun 4, 2023 · 2 comments
Open

Distinguish block & inline equations #5

Triton171 opened this issue Jun 4, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@Triton171
Copy link

Currently, the grammar parses both inline and block equations as an equation node. It would be nice to parse them as inline_equation and block_equation nodes respectively, for example to highlight them differently like Helix does for LaTex. I've tried implementing this but it seems a bit tricky. We'd probably need something like a trimmed_math node that matches math without any surrounding whitespace. If this is something that you'd consider merging, I'll try to implement it. I'm also happy about any suggestions on how to best approach this.

@slashformotion
Copy link

@Triton171 if you have the knowledge on how to implement it, I would say go for it.

@frozolotl frozolotl added the enhancement New feature or request label Jun 20, 2023
@frozolotl
Copy link
Owner

frozolotl commented Aug 19, 2023

I tried integrating it into the grammar itself first, but my current implementation doesn't quite work correctly. For now I don't want to spend more time on it, as it's rather low-priority.

However, I figured that you could simply implement such a thing within the highlights.scm:

((equation) @equation.block
  (#match? @equation.block "[ \t\r\n]+.+[ \t\r\n]+"))
(equation) @equation.inline

I haven't tested it much and there are problems with it, but it should work well enough for now.

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

No branches or pull requests

3 participants