diff options
| author | Christian Clason <c.clason@uni-graz.at> | 2024-01-17 16:55:52 +0100 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2024-01-21 10:41:18 +0100 |
| commit | f5dc45310941dff6efc02d955fc0c110190e9b85 (patch) | |
| tree | ee4f96087a641dbd0df21cc9db46061c5864dae2 /runtime/queries/markdown_inline | |
| parent | fa9a85ae468b9df30ae9e5c05a08c0f124e267df (diff) | |
| download | rneovim-f5dc45310941dff6efc02d955fc0c110190e9b85.tar.gz rneovim-f5dc45310941dff6efc02d955fc0c110190e9b85.tar.bz2 rneovim-f5dc45310941dff6efc02d955fc0c110190e9b85.zip | |
feat(treesitter)!: new standard capture names
Problem: Sharing queries with upstream and Helix is difficult due to
different capture names.
Solution: Define and document a new set of standard captures that
matches tree-sitter "standard captures" (where defined) and is closer to
Helix' Atom-style nested groups.
This is a breaking change for colorschemes that defined highlights based
on the old captures. On the other hand, the default colorscheme now
defines links for all standard captures (not just those used in bundled
queries), improving the out-of-the-box experience.
Diffstat (limited to 'runtime/queries/markdown_inline')
| -rw-r--r-- | runtime/queries/markdown_inline/highlights.scm | 100 | ||||
| -rw-r--r-- | runtime/queries/markdown_inline/injections.scm | 9 |
2 files changed, 57 insertions, 52 deletions
diff --git a/runtime/queries/markdown_inline/highlights.scm b/runtime/queries/markdown_inline/highlights.scm index c75da478af..e9b41c31d5 100644 --- a/runtime/queries/markdown_inline/highlights.scm +++ b/runtime/queries/markdown_inline/highlights.scm @@ -1,49 +1,26 @@ -;; From MDeiml/tree-sitter-markdown -[ - (code_span) - (link_title) -] @text.literal @nospell - -[ - (emphasis_delimiter) - (code_span_delimiter) -] @punctuation.delimiter - -(emphasis) @text.emphasis +; From MDeiml/tree-sitter-markdown +(code_span) @markup.raw @nospell -(strong_emphasis) @text.strong +(emphasis) @markup.italic -(strikethrough) @text.strike - -[ - (link_destination) - (uri_autolink) -] @text.uri @nospell +(strong_emphasis) @markup.strong -(shortcut_link (link_text) @nospell) +(strikethrough) @markup.strikethrough -[ - (link_label) - (link_text) - (image_description) -] @text.reference +(shortcut_link + (link_text) @nospell) [ (backslash_escape) (hard_line_break) ] @string.escape -(image "!" @punctuation.special) -(image ["[" "]" "(" ")"] @punctuation.bracket) -(inline_link ["[" "]" "(" ")"] @punctuation.bracket) -(shortcut_link ["[" "]"] @punctuation.bracket) - ; Conceal codeblock and text style markers -([ - (code_span_delimiter) - (emphasis_delimiter) -] @conceal -(#set! conceal "")) +((code_span_delimiter) @markup.raw.delimiter + (#set! conceal "")) + +((emphasis_delimiter) @conceal + (#set! conceal "")) ; Conceal inline links (inline_link @@ -53,7 +30,7 @@ "(" (link_destination) ")" - ] @conceal + ] @markup.link (#set! conceal "")) ; Conceal image links @@ -65,7 +42,7 @@ "(" (link_destination) ")" - ] @conceal + ] @markup.link (#set! conceal "")) ; Conceal full reference links @@ -74,7 +51,7 @@ "[" "]" (link_label) - ] @conceal + ] @markup.link (#set! conceal "")) ; Conceal collapsed reference links @@ -82,7 +59,7 @@ [ "[" "]" - ] @conceal + ] @markup.link (#set! conceal "")) ; Conceal shortcut links @@ -90,13 +67,42 @@ [ "[" "]" - ] @conceal + ] @markup.link (#set! conceal "")) -;; Replace common HTML entities. -((entity_reference) @conceal (#eq? @conceal " ") (#set! conceal "")) -((entity_reference) @conceal (#eq? @conceal "<") (#set! conceal "<")) -((entity_reference) @conceal (#eq? @conceal ">") (#set! conceal ">")) -((entity_reference) @conceal (#eq? @conceal "&") (#set! conceal "&")) -((entity_reference) @conceal (#eq? @conceal """) (#set! conceal "\"")) -((entity_reference) @conceal (#any-of? @conceal " " " ") (#set! conceal " ")) +[ + (link_destination) + (uri_autolink) +] @markup.link.url @nospell + +[ + (link_label) + (link_text) + (link_title) + (image_description) +] @markup.link.label + +; Replace common HTML entities. +((entity_reference) @character.special + (#eq? @character.special " ") + (#set! conceal "")) + +((entity_reference) @character.special + (#eq? @character.special "<") + (#set! conceal "<")) + +((entity_reference) @character.special + (#eq? @character.special ">") + (#set! conceal ">")) + +((entity_reference) @character.special + (#eq? @character.special "&") + (#set! conceal "&")) + +((entity_reference) @character.special + (#eq? @character.special """) + (#set! conceal "\"")) + +((entity_reference) @character.special + (#any-of? @character.special " " " ") + (#set! conceal " ")) diff --git a/runtime/queries/markdown_inline/injections.scm b/runtime/queries/markdown_inline/injections.scm index f7aa19caff..6448b77c1b 100644 --- a/runtime/queries/markdown_inline/injections.scm +++ b/runtime/queries/markdown_inline/injections.scm @@ -1,8 +1,7 @@ ((html_tag) @injection.content - (#set! injection.language "html") - (#set! injection.combined) - (#set! injection.include-children)) + (#set! injection.language "html") + (#set! injection.combined)) ((latex_block) @injection.content - (#set! injection.language "latex") - (#set! injection.include-children)) + (#set! injection.language "latex") + (#set! injection.include-children)) |