@@ -10,13 +10,19 @@ Check the playground at <https://stsewd.dev/tree-sitter-comment/>.
10
10
Since comment tags aren't a programming language or have a standard,
11
11
I have chosen to follow popular conventions for the syntax.
12
12
13
+ ### Comment tags
14
+
13
15
* Comment tags can contain:
14
16
- Upper case ascii letters
15
17
- Numbers (can't start with one)
16
18
- ` - ` , ` _ ` (they can't start or end whit these characters)
17
19
* Optionally can have an user linked to the tag inside parentheses ` () `
18
20
* The name must be followed by ` : ` and a whitespace
19
21
22
+ ### URIs
23
+
24
+ * http and https links are recognized
25
+
20
26
If you think there are other popular conventions this syntax doesn't cover,
21
27
feel free to open a issue.
22
28
@@ -33,12 +39,37 @@ XXX: extra white spaces.
33
39
34
40
NOTE-BUG (stsewd): tags can be separated by `-`
35
41
NOTE_BUG: or by `_`.
42
+
43
+ This will be recognized as a URI
44
+ https://github.com/stsewd/
45
+ ```
46
+
47
+ ## FAQ
48
+
49
+ ### Can I match a tag that doesn't end in ` : ` , like ` TODO ` ?
50
+
51
+ This grammar doesn't provide a specific token for it,
52
+ but you can match it with this query:
53
+
54
+ ``` scm
55
+ ("text" @todo
56
+ (#eq? @todo "TODO"))
36
57
```
37
58
38
- ## TODO
59
+ ### Can I highlight references to issues, PRs, MRs, like ` #10 ` or ` !10 ` ?
39
60
40
- - Detect links?
41
- - Detect tags that start with ` # ` (like when linking to a PR)?
61
+ This grammar doesn't provide a specific token for it,
62
+ but you can match it with this query:
63
+
64
+ ``` scm
65
+ ("text" @issue
66
+ (#match? @issue "^#[0-9]+$"))
67
+
68
+ ;; NOTE: This matches `!10` and `! 10`.
69
+ ("text" @symbol . "text" @issue
70
+ (#eq? @symbol "!")
71
+ (#match? @issue "^[0-9]+$"))
72
+ ```
42
73
43
74
## Why C?
44
75
0 commit comments