changeset 6724:e816d3ad61cf

docs: another injection query example (#13312)
author Niklas Gruhn <niklas@gruhn.me>
date Wed, 09 Apr 2025 14:30:11 +0200
parents b3aca2ce55eb
children 06c821bf8f6b
files book/src/guides/injection.md
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/book/src/guides/injection.md	Tue Apr 08 11:58:14 2025 -0700
+++ b/book/src/guides/injection.md	Wed Apr 09 14:30:11 2025 +0200
@@ -4,11 +4,16 @@
 In addition to the [standard][upstream-docs] language injection options used by tree-sitter, there
 are a few Helix specific extensions that allow for more control.
 
-And example of a simple query that would highlight all strings as bash in Nix:
+An example of a simple query that would highlight all strings as bash in Nix:
 ```scm
 ((string_expression (string_fragment) @injection.content)
   (#set! injection.language "bash"))
 ```
+Another example is this query, which highlights links in comments and keywords like "TODO", by reusing the dedicated "comment" language:
+```
+((comment) @injection.content
+  (#set! injection.language "comment"))
+```
 
 ## Capture Types