diff options
-rw-r--r-- | book/src/generated/lang-support.md | 1 | ||||
-rw-r--r-- | languages.toml | 11 | ||||
-rw-r--r-- | runtime/queries/markdoc/highlights.scm | 16 | ||||
-rw-r--r-- | runtime/queries/markdoc/injections.scm | 2 |
4 files changed, 30 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 28dfeb04..07aabef8 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -81,6 +81,7 @@ | llvm-mir-yaml | ✓ | | ✓ | | | lua | ✓ | ✓ | ✓ | `lua-language-server` | | make | ✓ | | | | +| markdoc | ✓ | | | `markdoc-ls` | | markdown | ✓ | | | `marksman` | | markdown.inline | ✓ | | | | | matlab | ✓ | | | | diff --git a/languages.toml b/languages.toml index 22c1842e..9e55dd4e 100644 --- a/languages.toml +++ b/languages.toml @@ -2461,3 +2461,14 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "hurl" source = { git = "https://github.com/pfeiferj/tree-sitter-hurl", rev = "264c42064b61ee21abe88d0061f29a0523352e22" } + +[[language]] +name = "markdoc" +scope = "text.markdoc" +roots = [] +file-types = ["mdoc"] +language-server = { command = "markdoc-ls", args = ["--stdio"] } + +[[grammar]] +name = "markdoc" +source = { git = "https://github.com/markdoc-extra/tree-sitter-markdoc", rev = "5ffe71b29e8a3f94823913ea9cea51fcfa7e3bf8" } diff --git a/runtime/queries/markdoc/highlights.scm b/runtime/queries/markdoc/highlights.scm new file mode 100644 index 00000000..8251e9af --- /dev/null +++ b/runtime/queries/markdoc/highlights.scm @@ -0,0 +1,16 @@ +tag_name: (identifier) @tag +(tag_self_closing "/" @tag) +(tag_close "/" @tag) +([(tag_start) (tag_end) "="] @tag) +(attribute [key : (identifier)] @attribute) +(attribute [shorthand : (identifier)] @attribute) +(variable [variable : (identifier) (variable_sigil)] @variable) +(variable_tail property : (identifier) @variable.other.member) +(function function_name : (identifier) @function) +(function_parameter_named parameter : (identifier) @variable.parameter) + +(hash_key key: (identifier) @variable.other.member) +(string) @string +(number) @constant.numeric +(boolean) @constant.builtin.boolean +(null) @constant.builtin diff --git a/runtime/queries/markdoc/injections.scm b/runtime/queries/markdoc/injections.scm new file mode 100644 index 00000000..1594546b --- /dev/null +++ b/runtime/queries/markdoc/injections.scm @@ -0,0 +1,2 @@ +((markdown) @injection.content + (#set! injection.language "markdown")) |