diff --git a/README.md b/README.md index 2ee8bcd..0017967 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ Check the playground at . Since comment tags aren't a programming language or have a standard, I have chosen to follow popular conventions for the syntax. +### Comment tags + * Comment tags can contain: - Upper case ascii letters - Numbers (can't start with one) @@ -17,6 +19,10 @@ I have chosen to follow popular conventions for the syntax. * Optionally can have an user linked to the tag inside parentheses `()` * The name must be followed by `:` and a whitespace +### URIs + +* http and https links are recognized + If you think there are other popular conventions this syntax doesn't cover, feel free to open a issue. @@ -33,12 +39,37 @@ XXX: extra white spaces. NOTE-BUG (stsewd): tags can be separated by `-` NOTE_BUG: or by `_`. + +This will be recognized as a URI +https://github.com/stsewd/ +``` + +## FAQ + +### Can I match a tag that doesn't end in `:`, like `TODO`? + +This grammar doesn't provide a specific token for it, +but you can match it with this query: + +```scm +("text" @todo + (#eq? @todo "TODO")) ``` -## TODO +### Can I highlight references to issues, PRs, MRs, like `#10` or `!10`? -- Detect links? -- Detect tags that start with `#` (like when linking to a PR)? +This grammar doesn't provide a specific token for it, +but you can match it with this query: + +```scm +("text" @issue + (#match? @issue "^#[0-9]+$")) + +;; NOTE: This matches `!10` and `! 10`. +("text" @symbol . "text" @issue + (#eq? @symbol "!") + (#match? @issue "^[0-9]+$")) +``` ## Why C? diff --git a/test/corpus/source.txt b/test/corpus/source.txt index d6fbef1..21b4813 100644 --- a/test/corpus/source.txt +++ b/test/corpus/source.txt @@ -92,7 +92,7 @@ URI: https://user:pass@example.com/org/repo/?foo=baz (https://example.com/foo/bar/) -URI(me): (https://example.com/foo/bar/?foo=bar) +URI(me): (https://github.com/stsewd/?foo=bar#baz) -------------------------------------------------------------------------------- @@ -107,4 +107,8 @@ URI(me): (https://example.com/foo/bar/?foo=bar) (tag (name)) (uri) + (uri) + (tag + (name) + (user)) (uri))