tree-sitter-grammars / tree-sitter-markdown

Markdown grammar for tree-sitter
MIT License
411 stars 52 forks source link

bug: Escaped `\$` counts as end of latex block #148

Open ribru17 opened 4 months ago

ribru17 commented 4 months ago

Did you check existing issues?

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

tree-sitter 0.22.5

Describe the bug

Basically, escaped latex dollar signs are counted as ending delimiters, so it is basically impossible to have a regular dollar sign inside of an inline-equation latex block.

Steps To Reproduce/Bad Parse Tree

(inline [0, 0] - [1, 0]
  (latex_block [0, 0] - [0, 8]
    (latex_span_delimiter [0, 0] - [0, 1])
    (latex_span_delimiter [0, 7] - [0, 8])))

Expected Behavior/Parse Tree

(inline [0, 0] - [1, 0]
  (latex_block [0, 0] - [0, 14]
    (latex_span_delimiter [0, 0] - [0, 1])
    (latex_span_delimiter [0, 13] - [0, 14])))

Repro

$hello\$there$

(and then tree-sitter parse)