on master help sign in
Add markdown grammar

Fixes #215

commit49e067874133e12d10ad3ac0c941438e2d7025e7 authorBlaž Hrastnik <blaz@mxxn.io> dateWed 15 Dec 2021, 00:45 (5 years ago) parent6da2174
7 files changed+56−1
.gitmodules+4 helix-syntax/languages/tree-sitter-markdown+1 languages.toml+9 runtime/queries/markdown/highlights.scm+35 runtime/queries/markdown/injections.scm runtime/queries/svelte/highlights.scm+1−1 theme.toml+6
.gitmodules+4
@@ -150,3 +150,7 @@
150150 path = helix-syntax/languages/tree-sitter-llvm
151151 url = https://github.com/benwilliamgraham/tree-sitter-llvm
152152 shallow = true
153+[submodule "helix-syntax/languages/tree-sitter-markdown"]
154+ path = helix-syntax/languages/tree-sitter-markdown
155+ url = https://github.com/MDeiml/tree-sitter-markdown
156+ shallow = true
helix-syntax/languages/tree-sitter-markdownnew file+1

Submodule changed.

languages.toml+9
@@ -421,3 +421,12 @@ roots = []
421421file-types = ["ll"]
422422comment-token = ";"
423423indent = { tab-width = 2, unit = " " }
424+
425+[[language]]
426+name = "markdown"
427+scope = "source.md"
428+injection-regex = "md|markdown"
429+file-types = ["md"]
430+roots = []
431+
432+indent = { tab-width = 2, unit = " " }
runtime/queries/markdown/highlights.scmnew file+35
@@ -0,0 +1,35 @@
1+[
2+ (atx_heading)
3+ (setext_heading)
4+] @markup.heading
5+
6+(code_fence_content) @none
7+
8+[
9+ (indented_code_block)
10+ (fenced_code_block)
11+] @markup.raw.block
12+
13+(code_span) @markup.raw.inline
14+
15+(emphasis) @markup.italic
16+
17+(strong_emphasis) @markup.bold
18+
19+(link_destination) @markup.underline.link
20+
21+; (link_label) @markup.label ; TODO: rename
22+
23+[
24+ (list_marker_plus)
25+ (list_marker_minus)
26+ (list_marker_star)
27+ (list_marker_dot)
28+ (list_marker_parenthesis)
29+] @punctuation.special
30+
31+[
32+ (backslash_escape)
33+ (hard_line_break)
34+] @string.character.escape
35+
runtime/queries/markdown/injections.scmnew file

No changes to the content.

runtime/queries/svelte/highlights.scm+1−1
@@ -25,7 +25,7 @@
2525
2626((attribute
2727 (attribute_name) @_attr
28− (quoted_attribute_value (attribute_value) @markup.undeline.link))
28+ (quoted_attribute_value (attribute_value) @markup.underline.link))
2929 (#match? @_attr "^(href|src)$"))
3030
3131(tag_name) @tag
theme.toml+6
@@ -28,6 +28,12 @@ string = "silver"
2828# used for lifetimes
2929label = "honey"
3030
31+"markup.heading" = "lilac"
32+"markup.bold" = { modifiers = ["bold"] }
33+"markup.italic" = { modifiers = ["italic"] }
34+"markup.underline.link" = { fg = "silver", modifiers = ["underlined"] }
35+"markup.raw" = "almond"
36+
3137# TODO: diferentiate doc comment
3238# concat (ERROR) @error.syntax and "MISSING ;" selectors for errors
3339