on master help sign in
Use split_parser branch for markdown grammar (#3108)
commitea04220874a262c2a2d64f8eb9e9cb3124eb0886 authorMatthias Deiml <matthias@deiml.net> dateSat 6 Aug 2022, 17:56 (4 years ago) parentc00b8f7
6 files changed+99−40
book/src/generated/lang-support.md+1 languages.toml+13−1 runtime/queries/markdown.inline/highlights.scm+39 runtime/queries/markdown.inline/injections.scm+2 runtime/queries/markdown/highlights.scm+30−31 runtime/queries/markdown/injections.scm+14−8
book/src/generated/lang-support.md+1
@@ -62,6 +62,7 @@
6262| lua | ✓ | | ✓ | `lua-language-server` |
6363| make | ✓ | | | |
6464| markdown | ✓ | | | |
65+| markdown.inline | ✓ | | | |
6566| meson | ✓ | | ✓ | |
6667| mint | | | | `mint` |
6768| nickel | ✓ | | ✓ | `nls` |
languages.toml+13−1
@@ -884,7 +884,19 @@ indent = { tab-width = 2, unit = " " }
884884
885885[[grammar]]
886886name = "markdown"
887−source = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "ab15701d8f3f68aeb74e30573b7d669a6ef2a7ed" }
887+source = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "142a5b4a1b092b64c9f5db8f11558f9dd4009a1b", subpath = "tree-sitter-markdown" }
888+
889+[[language]]
890+name = "markdown.inline"
891+scope = "source.markdown.inline"
892+injection-regex = "markdown\\.inline"
893+file-types = []
894+roots = []
895+grammar = "markdown_inline"
896+
897+[[grammar]]
898+name = "markdown_inline"
899+source = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "142a5b4a1b092b64c9f5db8f11558f9dd4009a1b", subpath = "tree-sitter-markdown-inline" }
888900
889901[[language]]
890902name = "dart"
runtime/queries/markdown.inline/highlights.scmnew file+39
@@ -0,0 +1,39 @@
1+;; From nvim-treesitter/nvim-treesitter
2+[
3+ (code_span)
4+ (link_title)
5+] @markup.raw.inline
6+
7+[
8+ (emphasis_delimiter)
9+ (code_span_delimiter)
10+] @punctuation.bracket
11+
12+(emphasis) @markup.italic
13+
14+(strong_emphasis) @markup.bold
15+
16+(strikethrough) @markup.strikethrough
17+
18+[
19+ (link_destination)
20+ (uri_autolink)
21+] @markup.link.url
22+
23+[
24+ (link_text)
25+ (image_description)
26+] @markup.link.text
27+
28+(link_label) @markup.link.label
29+
30+[
31+ (backslash_escape)
32+ (hard_line_break)
33+] @constant.character.escape
34+
35+(image ["[" "]" "(" ")"] @punctuation.bracket)
36+(image "!" @punctuation.special)
37+(inline_link ["[" "]" "(" ")"] @punctuation.bracket)
38+(shortcut_link ["[" "]"] @punctuation.bracket)
39+
runtime/queries/markdown.inline/injections.scmnew file+2
@@ -0,0 +1,2 @@
1+
2+((html_tag) @injection.content (#set! injection.language "html"))
runtime/queries/markdown/highlights.scm+30−31
@@ -1,54 +1,53 @@
1−(setext_heading (heading_content) @markup.heading.1 (setext_h1_underline) @markup.heading.marker)
2−(setext_heading (heading_content) @markup.heading.2 (setext_h2_underline) @markup.heading.marker)
31
4−(atx_heading (atx_h1_marker) @markup.heading.marker (heading_content) @markup.heading.1)
5−(atx_heading (atx_h2_marker) @markup.heading.marker (heading_content) @markup.heading.2)
6−(atx_heading (atx_h3_marker) @markup.heading.marker (heading_content) @markup.heading.3)
7−(atx_heading (atx_h4_marker) @markup.heading.marker (heading_content) @markup.heading.4)
8−(atx_heading (atx_h5_marker) @markup.heading.marker (heading_content) @markup.heading.5)
9−(atx_heading (atx_h6_marker) @markup.heading.marker (heading_content) @markup.heading.6)
2+(setext_heading (paragraph) @markup.heading.1 (setext_h1_underline) @markup.heading.marker)
3+(setext_heading (paragraph) @markup.heading.2 (setext_h2_underline) @markup.heading.marker)
4+
5+(atx_heading (atx_h1_marker) @markup.heading.marker (inline) @markup.heading.1)
6+(atx_heading (atx_h2_marker) @markup.heading.marker (inline) @markup.heading.2)
7+(atx_heading (atx_h3_marker) @markup.heading.marker (inline) @markup.heading.3)
8+(atx_heading (atx_h4_marker) @markup.heading.marker (inline) @markup.heading.4)
9+(atx_heading (atx_h5_marker) @markup.heading.marker (inline) @markup.heading.5)
10+(atx_heading (atx_h6_marker) @markup.heading.marker (inline) @markup.heading.6)
1011
1112[
1213 (indented_code_block)
13− (code_fence_content)
14+ (fenced_code_block)
1415] @markup.raw.block
1516
16−(block_quote) @markup.quote
17−
18−(code_span) @markup.raw.inline
19−
20−(emphasis) @markup.italic
21−
22−(strong_emphasis) @markup.bold
17+(info_string) @label
2318
24−(link_destination) @markup.link.url
25−(link_label) @markup.link.label
19+[
20+ (fenced_code_block_delimiter)
21+] @punctuation.bracket
2622
27−(info_string) @label
23+[
24+ (link_destination)
25+] @markup.link.url
2826
2927[
30− (link_text)
31− (image_description)
32−] @markup.link.text
28+ (link_label)
29+] @markup.link.label
3330
3431[
3532 (list_marker_plus)
3633 (list_marker_minus)
3734 (list_marker_star)
38−] @markup.list.numbered
35+] @markup.list.unnumbered
3936
4037[
4138 (list_marker_dot)
4239 (list_marker_parenthesis)
43−] @markup.list.unnumbered
40+] @markup.list.numbered
41+
42+(thematic_break) @punctuation.delimiter
4443
4544[
46− (backslash_escape)
47− (hard_line_break)
48−] @constant.character.escape
45+ (block_continuation)
46+ (block_quote_marker)
47+] @punctuation.special
4948
50−(thematic_break) @punctuation.delimiter
49+[
50+ (backslash_escape)
51+] @string.escape
5152
52−(inline_link ["[" "]" "(" ")"] @punctuation.bracket)
53−(image ["[" "]" "(" ")"] @punctuation.bracket)
54−(fenced_code_block_delimiter) @punctuation.bracket
53+(block_quote) @markup.quote
runtime/queries/markdown/injections.scm+14−8
@@ -1,9 +1,15 @@
1+; From nvim-treesitter/nvim-treesitter
2+
13(fenced_code_block
2− (info_string) @injection.language
3− (code_fence_content) @injection.content
4− (#set! injection.include-children))
5−
6−((html_block) @injection.content
7− (#set! injection.language "html"))
8−((html_tag) @injection.content
9− (#set! injection.language "html"))
4+ (info_string
5+ (language) @injection.language)
6+ (code_fence_content) @injection.content (#set! injection.include-unnamed-children))
7+
8+((html_block) @injection.content (#set! injection.language "html") (#set! injection.include-unnamed-children))
9+
10+([
11+ (minus_metadata)
12+ (plus_metadata)
13+] @injection.content (#set! injection.language "yaml") (#set! injection.include-unnamed-children))
14+
15+((inline) @injection.content (#set! injection.language "markdown.inline") (#set! injection.include-unnamed-children))