mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 11:20:07 -04:00
feat(markdown)!: switch to split parser (#3048)
* switch to split markdown parser with separate block and inline parsers to improve performance * add exclude_children! directive (useful for something like Injected markdown incorrectly highlights indented docstrings #2212) * split markdown queries into block and inline ones and add the injection for inline into block grammar * add include_dir option to parser configs (needed because the two grammars don't live in the repos root directory) BREAKING CHANGE: downstream queries need to be adapted to new parser
This commit is contained in:
parent
d810c38634
commit
002084b1be
7 changed files with 121 additions and 61 deletions
|
|
@ -1,6 +1,6 @@
|
|||
;; From MDeiml/tree-sitter-markdown
|
||||
(atx_heading (heading_content) @text.title)
|
||||
(setext_heading (heading_content) @text.title)
|
||||
;From MDeiml/tree-sitter-markdown
|
||||
(atx_heading (inline) @text.title)
|
||||
(setext_heading (paragraph) @text.title)
|
||||
|
||||
[
|
||||
(atx_h1_marker)
|
||||
|
|
@ -14,33 +14,23 @@
|
|||
] @punctuation.special
|
||||
|
||||
[
|
||||
(code_span)
|
||||
(link_title)
|
||||
(indented_code_block)
|
||||
(fenced_code_block)
|
||||
] @text.literal
|
||||
|
||||
[
|
||||
(emphasis_delimiter)
|
||||
(code_span_delimiter)
|
||||
(fenced_code_block_delimiter)
|
||||
] @punctuation.delimiter
|
||||
|
||||
(code_fence_content) @none
|
||||
|
||||
(emphasis) @text.emphasis
|
||||
|
||||
(strong_emphasis) @text.strong
|
||||
|
||||
[
|
||||
(link_destination)
|
||||
(uri_autolink)
|
||||
] @text.uri
|
||||
|
||||
[
|
||||
(link_label)
|
||||
(link_text)
|
||||
(image_description)
|
||||
] @text.reference
|
||||
|
||||
[
|
||||
|
|
@ -52,56 +42,17 @@
|
|||
(thematic_break)
|
||||
] @punctuation.special
|
||||
|
||||
(block_quote_marker) @punctuation.special
|
||||
[
|
||||
(block_continuation)
|
||||
(block_quote_marker)
|
||||
] @punctuation.special
|
||||
|
||||
[
|
||||
(backslash_escape)
|
||||
(hard_line_break)
|
||||
] @string.escape
|
||||
|
||||
(image "!" @punctuation.delimiter)
|
||||
(image "[" @punctuation.delimiter)
|
||||
(image "]" @punctuation.delimiter)
|
||||
(image "(" @punctuation.delimiter)
|
||||
; (image ")" @punctuation.delimiter)
|
||||
|
||||
(inline_link "[" @punctuation.delimiter)
|
||||
(inline_link "]" @punctuation.delimiter)
|
||||
(inline_link "(" @punctuation.delimiter)
|
||||
; (inline_link ")" @punctuation.delimiter)
|
||||
|
||||
(shortcut_link "[" @punctuation.delimiter)
|
||||
(shortcut_link "]" @punctuation.delimiter)
|
||||
|
||||
([
|
||||
(info_string)
|
||||
(fenced_code_block_delimiter)
|
||||
(code_span_delimiter)
|
||||
(emphasis_delimiter)
|
||||
] @conceal
|
||||
(#set! conceal ""))
|
||||
|
||||
|
||||
; Conceal inline links
|
||||
(inline_link
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
"("
|
||||
(link_destination)
|
||||
")"
|
||||
] @conceal
|
||||
(#set! conceal ""))
|
||||
|
||||
|
||||
; Conceal image links
|
||||
(image
|
||||
[
|
||||
"!"
|
||||
"["
|
||||
"]"
|
||||
"("
|
||||
(link_destination)
|
||||
")"
|
||||
] @conceal
|
||||
(#set! conceal ""))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue