Skip to content

Commit 72adf1f

Browse files
gruhnLucas Renaudineau
authored and
Lucas Renaudineau
committed
docs: another injection query example (#13312)
1 parent 02bb285 commit 72adf1f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

book/src/guides/injection.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ Writing language injection queries allows one to highlight a specific node as a
44
In addition to the [standard][upstream-docs] language injection options used by tree-sitter, there
55
are a few Helix specific extensions that allow for more control.
66

7-
And example of a simple query that would highlight all strings as bash in Nix:
7+
An example of a simple query that would highlight all strings as bash in Nix:
88
```scm
99
((string_expression (string_fragment) @injection.content)
1010
(#set! injection.language "bash"))
1111
```
12+
Another example is this query, which highlights links in comments and keywords like "TODO", by reusing the dedicated "comment" language:
13+
```
14+
((comment) @injection.content
15+
(#set! injection.language "comment"))
16+
```
1217

1318
## Capture Types
1419

0 commit comments

Comments
 (0)