Code tags#
Tags are written inside comments. The comment style is chosen per file extension, so the same tag syntax works across many languages. Multi-line comment blocks are supported; each tag may sit on its own line inside a block.
Comment styles#
| Comment family | Line | Block | Extensions |
|---|---|---|---|
| C-like | // |
/* … */ |
.ts .js .mjs .cjs .jsx .tsx .cts .mts .c .h .cpp .cc .hpp .cxx .hxx .ino .inl .tpp .cs .java .go .groovy .gradle .sol .dart .proto .scss .less |
| C-like, nesting | // |
/* … */ (nestable) |
.rs .swift .kt .kts .scala |
| PHP | // # |
/* … */ |
.php |
| Hash | # |
– | .py .rb .sh .bash .zsh .yaml .yml .toml .r .pm .ex .exs .tcl .cr .gd .awk .graphql .gql |
| CoffeeScript | # |
### … ### (opener not followed by #) |
.coffee |
| Julia | # |
#= … =# (nestable) |
.jl |
| Nim | # |
#[ … ]# ##[ … ]## (nestable) |
.nim |
| CMake | # |
#[[ … ]] |
.cmake |
| PowerShell | # |
<# … #> |
.ps1 .psm1 |
| HCL | # // |
/* … */ |
.tf .tfvars .hcl |
| Semicolon | ; |
– | .clj .cljs .cljc .edn .el .lisp |
| Scheme/Racket | ; |
#| … |# (nestable) |
.scm .ss .rkt |
| Percent | % |
– | .erl .hrl .tex .sty |
| SQL | -- |
/* … */ |
.sql |
| Dash (line only) | -- |
– | .adb .ads .vhd .vhdl |
| Lua | -- |
--[[ … ]] |
.lua |
| Haskell | -- |
{- … -} (nestable) |
.hs .elm .purs |
| ML-family | // (F#) |
(* … *) (nestable) |
.ml .mli .fs .fsi .fsx |
| Pascal | // |
{ … }, (* … *) |
.pas .dpr |
| CSS | – | /* … */ |
.css |
| HTML/XML | – | <!-- … --> |
.xml .svg |
| HTML + embedded | – | <!-- … --> (markup) |
.html .htm .vue .svelte |
In CoffeeScript a run of four or more # is a line comment, not a block opener, so a #### Section heading or a ########## divider comments out only its own line.
HTML and embedded languages#
HTML-family files switch comment style by region: <!-- … --> in markup, C-like comments (//, /* … */) inside <script>, and CSS comments (/* … */) inside <style>. So a // in template text or a URL is not treated as a comment - only a real HTML comment is. A region ends at the first </script>/</style> (as a browser tokenizes it), so a literal </script> meant as script text should be written <\/script>.
The embedded grammar follows the tag's type/lang attribute: <script type="application/json"> is scanned with no comments (so a // in a JSON string is not one), <script type="text/x-template"> as HTML markup, and <style lang="scss"> / less / sass also honour //.
URLs#
Comment markers inside URL-shaped text never open a comment, in any grammar: in https://example.com/a--b#anchor neither the // nor the -- nor the # starts a comment. URL-shaped means a scheme followed by ://; the URL extends until whitespace (as Text handling defines it), a quote, a bracket or an angle bracket, so a tag written next to a URL is unaffected. Markers that close an already open block comment are still honoured inside a URL.
Tag forms#
[<type>:[<group>/…]<name>#<revision>]- defines a coverage item with that ID. It satisfies everyNeedsentry (anywhere in the project) that names this ID - revisions compared SemVer-equal, so#2.4satisfies a need for#2.4.0.[>><type>:[<group>/…]<name>#<revision>]- attaches a need to the nearest preceding item tag in the same file. If no item tag precedes it, this is reported as an error.[<source-id> >> <target-id>]- attaches the need<target-id>to the preceding item tag with<source-id>(a SemVer-equal revision spelling counts) in the same file (spaces around>>optional). If no such item tag precedes it, this is reported as an error. Unlike the implicit form, it stays attached to its item even when another item tag is later inserted in between.
The need target of either form may use a wildcard revision (e.g. [>>utest:auth/login#2.x]) or a short form that drops whatever the item the need attaches to already fixes - its [group/…]name, its #<revision>, or both. After [impl:auth/login#1], the tag [>>utest#1] demands utest:auth/login#1 (name taken from the anchor), [>>utest:auth/audit] demands utest:auth/audit#1 (revision taken), and [>>utest] demands utest:auth/login#1 (both taken). Only the leading <type> is mandatory. The item tag and the <source-id> anchor must name a full ID with a concrete revision.
[<source-id> --> <target-id>]- forwards the source item's coverage obligation to the target; see Forwarding / delegation. It defines no item and does not anchor[>>…]tags.
// [impl:auth/login#1]
// [>>utest:auth/login#1]
export function login(token: SessionToken) { … }
The explicit form keeps the attachment stable when tags sit further apart:
// [impl:auth/login#1]
export function login(token: SessionToken) {
// [impl:auth/audit#1] <- would steal a [>>…] tag placed below
audit(token);
// [impl:auth/login#1 >> impl:auth/session#1]
return openSession(token);
}
Neither need form defines an item or moves the anchor of later [>>…] tags.
File selection#
Directory scanning evaluates ignore rules directly in Rust; no Git executable is
required or launched. It respects parent and nested .gitignore and .ignore
files, .git/info/exclude, and the user's global Git ignore file (including
core.excludesFile in the user's Git configuration). .ignore takes precedence
over .gitignore. These rules also apply outside Git repositories; parent rules
can apply from above a repository root.
Hidden files and directories such as .github/ remain eligible. .git/ metadata
and node_modules/ dependency directories are always excluded from traversal,
including when supplied as directory scan roots. Directory
symlinks are not followed, and symlink entries discovered during traversal are
not scanned. Explicit file arguments bypass ignore rules, but must still have a
supported extension. Results are deduplicated and sorted.
Ignored files and explicit overrides do not produce warnings.