tree-sitter-grammars / tree-sitter-markdown

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

Highlight comments #89

Closed mrtnvgr closed 1 year ago

mrtnvgr commented 1 year ago

Hello! I'm unsure if it has been already implemented, but I don't get any comment highlighting.

I think it should highlight like github does:

Normal text
<!-- Commented text -->

My screenshot:

MDeiml commented 1 year ago

What editor are you using?

Comments are a bit weird at the moment. The spec says that they should be treated like html, so that's what the parser is doing. Basically it's just marking <!-- comment --> to be parsed by the html parser (which is called "language injection"), and the html parser of course figures out it's a comment. What you're experiencing is probably a problem with the html parser or the language injection process.

I admit this is overly complicated. This parser should probably be changed to handle comments by itself. I'll see if I get around to implementing that soon.

mrtnvgr commented 1 year ago

What editor are you using?

Neovim

mrtnvgr commented 1 year ago

... Basically it's just marking <!-- comment --> to be parsed by the html parser ...

Thank you! I installed html parser and everything works now!

I'll see if I get around to implementing that soon.

🚀 🚀 🚀