aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Vidal2023-03-05 02:36:01 +0000
committerGitHub2023-03-05 02:36:01 +0000
commit725d9aecf08262e83553e54aa57d9bbec4841c80 (patch)
tree427a4126b46a5f84c8ec8bd80783923c85fdad00
parentcf153080d7712f9a03e5e2c30bbae10eade1dc74 (diff)
Add support for reStructuredText (#6180)
-rw-r--r--book/src/generated/lang-support.md1
-rw-r--r--languages.toml11
-rw-r--r--runtime/queries/rst/highlights.scm38
3 files changed, 50 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index cf8e5023..48cb66f1 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -114,6 +114,7 @@
| rescript | ✓ | ✓ | | `rescript-language-server` |
| rmarkdown | ✓ | | ✓ | `R` |
| ron | ✓ | | ✓ | |
+| rst | ✓ | | | |
| ruby | ✓ | ✓ | ✓ | `solargraph` |
| rust | ✓ | ✓ | ✓ | `rust-analyzer` |
| sage | ✓ | ✓ | | |
diff --git a/languages.toml b/languages.toml
index b0a34be0..e9a77b5a 100644
--- a/languages.toml
+++ b/languages.toml
@@ -2244,3 +2244,14 @@ indent = { tab-width = 8, unit = " " }
[[grammar]]
name = "nasm"
source = { git = "https://github.com/naclsn/tree-sitter-nasm", rev = "a0db15db6fcfb1bf2cc8702500e55e558825c48b" }
+
+[[language]]
+name = "rst"
+scope = "source.rst"
+comment-token = ".."
+file-types = ["rst"]
+roots = []
+
+[[grammar]]
+name = "rst"
+source = { git = "https://github.com/stsewd/tree-sitter-rst", rev = "25e6328872ac3a764ba8b926aea12719741103f1" }
diff --git a/runtime/queries/rst/highlights.scm b/runtime/queries/rst/highlights.scm
new file mode 100644
index 00000000..73c0def4
--- /dev/null
+++ b/runtime/queries/rst/highlights.scm
@@ -0,0 +1,38 @@
+(comment) @comment
+
+[
+ (title)
+] @markup.heading.1
+
+[
+ "adornment"
+] @markup.heading.marker
+
+[
+ (target)
+ (reference)
+] @markup.link.url
+
+[
+ "bullet"
+] @markup.list.unnumbered
+
+(strong) @markup.bold
+(emphasis) @markup.italic
+(literal) @markup.raw.inline
+
+(list_item
+ (term) @markup.bold
+ (classifier)? @markup.italic)
+
+(directive
+ [".." (type) "::"] @function
+)
+
+(field
+ [":" (field_name) ":"] @variable.other.member
+)
+
+(interpreted_text) @markup.raw.inline
+
+(interpreted_text (role)) @keyword