tree-sitter-grammars / tree-sitter-markdown

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

Highlight group suggestions #20

Closed pwntester closed 2 years ago

pwntester commented 2 years ago

Thanks for the awesome parser!

I have some suggestions that could improve the highlighting:

Thanks again!

pwntester commented 2 years ago

Oh, just figured out this issue belongs to nvim-treesitter, not here. Thanks again!

pwntester commented 2 years ago

Looking at the parsed elements, I miss:

I feel like at least the first two should have their own elements. Is it possible to add them?

MDeiml commented 2 years ago

Good suggestions. For the fenced code block delimiters a current work around would be to set the whole code block to be TSPunctDelimiter and setting the content to be TSLiteral. The other two need extra nodes, I think it would also maybe be nicer to add nodes for the fenced code block delimiters as well.

David-Else commented 2 years ago

Hi, I am trying to add the right highlights to a theme for Treesitter and wondered if anyone could advise me which to use for the following bold parts of the text? (they won't all render bold on GitHub, so I stuck them in a code block)

**#** Heading 1
**##** Heading 2
**###** Heading 3

**-** unordered list
**-** unordered list

**1.** ordered list
**2.** ordered list

!(**image**)[url]

**>** note

The details of the colors with screenshots are at: https://github.com/Mofiqul/vscode.nvim/pull/30

MDeiml commented 2 years ago

The highlights.scm from this repository does not work with what you want to do, but you could easily write your own queries. If you're not familiar with tree-sitter queries you can look at the tree-sitter documentation for syntax highlighting.

With that said

pwntester commented 2 years ago

For now, I submitted this PR to highlight link delimiters and frontmatter

MDeiml commented 2 years ago

Everything discussed here should be implemented now as far as I know (for now the closing ) are deactivated in nvim-treesitter because of an internal problem, see https://github.com/nvim-treesitter/nvim-treesitter/issues/2206).