ikatyang / tree-sitter-markdown

Markdown grammar for tree-sitter
https://ikatyang.github.io/tree-sitter-markdown
MIT License
180 stars 29 forks source link

link_reference_definition not parsed when on last line of file #47

Open mjbvz opened 2 years ago

mjbvz commented 2 years ago

Steps to reproduce

Parse the markdown:

[ref]

[ref]: http://example.com

Bug 🐛

This results in the tree:

(document (paragraph (link (link_text (text)))) (paragraph (link (link_text (text))) (text) (uri_autolink (text))))

Notice how the link definition is not found

Expected

If I add a blank line the end of the file like so:

[ref]

[ref]: http://example.com

I instead see:

(document (paragraph (link (link_text (text)))) (link_reference_definition (link_label (text)) (link_destination (text))))

This seems to be the expected parsing

D00mch commented 2 years ago

I have also created issue in treesitter repo.

D00mch commented 2 years ago

seems like this is a different problem, sorry