Skip to content

Commit

Permalink
Add markdown grammar
Browse files Browse the repository at this point in the history
Fixes #215
  • Loading branch information
archseer committed Dec 14, 2021
1 parent 6da2174 commit 49e0678
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,7 @@
path = helix-syntax/languages/tree-sitter-llvm
url = https://github.com/benwilliamgraham/tree-sitter-llvm
shallow = true
[submodule "helix-syntax/languages/tree-sitter-markdown"]
path = helix-syntax/languages/tree-sitter-markdown
url = https://github.com/MDeiml/tree-sitter-markdown
shallow = true
1 change: 1 addition & 0 deletions helix-syntax/languages/tree-sitter-markdown
Submodule tree-sitter-markdown added at ad8c32
9 changes: 9 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -421,3 +421,12 @@ roots = []
file-types = ["ll"]
comment-token = ";"
indent = { tab-width = 2, unit = " " }

[[language]]
name = "markdown"
scope = "source.md"
injection-regex = "md|markdown"
file-types = ["md"]
roots = []

indent = { tab-width = 2, unit = " " }
35 changes: 35 additions & 0 deletions runtime/queries/markdown/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[
(atx_heading)
(setext_heading)
] @markup.heading

(code_fence_content) @none

[
(indented_code_block)
(fenced_code_block)
] @markup.raw.block

(code_span) @markup.raw.inline

(emphasis) @markup.italic

(strong_emphasis) @markup.bold

(link_destination) @markup.underline.link

; (link_label) @markup.label ; TODO: rename

[
(list_marker_plus)
(list_marker_minus)
(list_marker_star)
(list_marker_dot)
(list_marker_parenthesis)
] @punctuation.special

[
(backslash_escape)
(hard_line_break)
] @string.character.escape

Empty file.
2 changes: 1 addition & 1 deletion runtime/queries/svelte/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

((attribute
(attribute_name) @_attr
(quoted_attribute_value (attribute_value) @markup.undeline.link))
(quoted_attribute_value (attribute_value) @markup.underline.link))
(#match? @_attr "^(href|src)$"))

(tag_name) @tag
Expand Down
6 changes: 6 additions & 0 deletions theme.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ string = "silver"
# used for lifetimes
label = "honey"

"markup.heading" = "lilac"
"markup.bold" = { modifiers = ["bold"] }
"markup.italic" = { modifiers = ["italic"] }
"markup.underline.link" = { fg = "silver", modifiers = ["underlined"] }
"markup.raw" = "almond"

# TODO: diferentiate doc comment
# concat (ERROR) @error.syntax and "MISSING ;" selectors for errors

Expand Down

0 comments on commit 49e0678

Please sign in to comment.