xref - speced/respec GitHub Wiki
Type: boolean | string | string[] | XrefOptions
Default: true (W3C profile)
Enables automatic cross-reference linking. When a term is wrapped in [= =] or {{ }} shorthand syntax, ReSpec automatically links it to the defining specification.
var respecConfig = {
xref: "web-platform",
};Then write terms naturally — ReSpec links them automatically:
<p>
[=Queue a task=] to [=fire an event=] named "fetch"
at the {{Window}} object.
</p>Understanding the pipeline helps when terms aren't found:
Your spec writes [=fetch=]
↓
ReSpec queries the xref service (respec.org/xref)
↓
Service looks up "fetch" in the WebRef database
↓
WebRef is populated by Reffy, which crawls published specs every 6 hours
↓
Reffy finds terms marked with <dfn data-export> in published specs
↓
Term found → generates <a href="https://fetch.spec.whatwg.org/#concept-fetch">fetch</a>
Term not found → ReSpec shows a red error banner
For a term to be findable via xref, ALL of these must be true:
- The defining spec is listed in browser-specs
- The defining spec is published (Editor's Drafts are crawled; unpublished local files are not)
- The
<dfn>in the defining spec hasdata-exportorclass="export" - Reffy has crawled it (within the last 6 hours for EDs; weekly for TR snapshots)
If a term isn't in the database, ask the defining spec's editors to add data-export. See data-export.
var respecConfig = {
xref: true,
};var respecConfig = {
xref: "web-platform",
};The "web-platform" profile includes: HTML, INFRA, URL, WEBIDL, DOM, FETCH.
var respecConfig = {
xref: ["FETCH", "DOM"],
};var respecConfig = {
xref: {
profile: "web-platform",
specs: ["PERMISSIONS", "SCREEN-WAKE-LOCK"],
},
};| Option | Type | Description |
|---|---|---|
profile |
string |
Pre-defined profile name (e.g. "web-platform") |
specs |
string[] |
Additional spec shortnames to include in lookups |
url |
string |
Custom xref API URL (advanced — not normally needed) |
- When both
profileandspecsare set, both sets of specs are used for disambiguation - To manually link to a specific anchor in another spec, use
data-cite - Browse and test xref lookups at respec.org/xref
- See Auto-linking external references for disambiguation and advanced usage