Open Triton171 opened 1 year ago
@Triton171 if you have the knowledge on how to implement it, I would say go for it.
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.
Currently, the grammar parses both inline and block equations as an
equation
node. It would be nice to parse them asinline_equation
andblock_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 atrimmed_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.