tree-sitter-grammars / tree-sitter-markdown

Markdown grammar for tree-sitter
MIT License
379 stars 45 forks source link

Multiple code spans with HTML comments does not working properly #36

Closed simonbs closed 1 year ago

simonbs commented 2 years ago

It seems that using multiple code spans with HTML comments isn't working properly. Using a single code span with a HTML comment is working fine though. Consider the following examples.

A single code span with a comment at the end of a paragraph works fine.

foo `<!--comment-->`
✅ (document (paragraph (html_tag)))

A single comment at the beginning of a paragraph works fine as well.

`<!--comment-->` foo
✅ (document (paragraph (html_tag)))

However, having two code spans with HTML results in incorrect results.

`<!--comment-->` foo `<!--comment-->`
❌ (document (paragraph (html_tag) (code_span (code_span_delimiter) (code_span_delimiter)) (html_tag)))

I'm not experienced with writing Tree-sitter parsers, so I'm unsure how the tree should look when parsing the last example. However, I think it's supposed to look like this:

(document (paragraph (html_tag) (html_tag)))
MDeiml commented 1 year ago

This is fixed with the most recent commit