on master help sign in
Add support for reStructuredText (#6180)
commit725d9aecf08262e83553e54aa57d9bbec4841c80 authorRoberto Vidal <roberto.vidal@ikumene.com> dateSun 5 Mar 2023, 03:36 (4 years ago) parentcf15308
3 files changed+50
book/src/generated/lang-support.md+1 languages.toml+11 runtime/queries/rst/highlights.scm+38
book/src/generated/lang-support.md+1
@@ -114,6 +114,7 @@
114114| rescript | ✓ | ✓ | | `rescript-language-server` |
115115| rmarkdown | ✓ | | ✓ | `R` |
116116| ron | ✓ | | ✓ | |
117+| rst | ✓ | | | |
117118| ruby | ✓ | ✓ | ✓ | `solargraph` |
118119| rust | ✓ | ✓ | ✓ | `rust-analyzer` |
119120| sage | ✓ | ✓ | | |
languages.toml+11
@@ -2244,3 +2244,14 @@ indent = { tab-width = 8, unit = " " }
22442244[[grammar]]
22452245name = "nasm"
22462246source = { git = "https://github.com/naclsn/tree-sitter-nasm", rev = "a0db15db6fcfb1bf2cc8702500e55e558825c48b" }
2247+
2248+[[language]]
2249+name = "rst"
2250+scope = "source.rst"
2251+comment-token = ".."
2252+file-types = ["rst"]
2253+roots = []
2254+
2255+[[grammar]]
2256+name = "rst"
2257+source = { git = "https://github.com/stsewd/tree-sitter-rst", rev = "25e6328872ac3a764ba8b926aea12719741103f1" }
runtime/queries/rst/highlights.scmnew file+38
@@ -0,0 +1,38 @@
1+(comment) @comment
2+
3+[
4+ (title)
5+] @markup.heading.1
6+
7+[
8+ "adornment"
9+] @markup.heading.marker
10+
11+[
12+ (target)
13+ (reference)
14+] @markup.link.url
15+
16+[
17+ "bullet"
18+] @markup.list.unnumbered
19+
20+(strong) @markup.bold
21+(emphasis) @markup.italic
22+(literal) @markup.raw.inline
23+
24+(list_item
25+ (term) @markup.bold
26+ (classifier)? @markup.italic)
27+
28+(directive
29+ [".." (type) "::"] @function
30+)
31+
32+(field
33+ [":" (field_name) ":"] @variable.other.member
34+)
35+
36+(interpreted_text) @markup.raw.inline
37+
38+(interpreted_text (role)) @keyword