data cite - speced/respec GitHub Wiki
Applies to: any element
Manually links an element to a specific term, section, or spec — or scopes all xref lookups within a container to a specific spec.
| Situation | Use |
|---|---|
| Term is in the xref database |
[=term=] shorthand (preferred) |
| Term is not exported by the defining spec |
data-cite="SPEC#anchor" on a container |
| Linking to a section heading (not a term) |
[[[SPEC#section-id]]] or data-cite="SPEC#section-id"
|
| Linking to the spec itself (bibliography) | data-cite="SPEC" |
| Documenting a term defined elsewhere (re-exporting) | <dfn data-cite="SPEC#dfn-id"> |
data-cite="[!]SPEC-ID[/path-to-doc][#fragment]"
-
!— normative citation (omit for informative) -
SPEC-ID— shortname from SpecRef -
/path-to-doc— sub-path for multi-page specs -
#fragment— anchor ID in the target document
When placed on any container element, data-cite scopes all {{IDL}}, [=term=], and [^element^] lookups within that element to the named spec. This is the preferred way to reference terms from specs not in your xref profile:
<section data-cite="fileapi">
<p>The {{Blob}} interface represents raw binary data.
A {{File}} is a {{Blob}} with a name.</p>
</section><li data-cite="fileapi">Assert: |data| is a {{Blob}}.</li><pre class="idl" data-cite="fileapi">
typedef (DOMString or Blob) DataSource;
</pre>This is far cleaner than manually writing <a data-cite="fileapi#dom-blob">Blob</a> for every reference. The scoped spec is also added to the document's bibliography automatically.
<a data-cite="FETCH#concept-request">request</a><a data-cite="!FETCH#concept-request">request</a><p>The <dfn data-export data-cite="DOM#concept-event">event</dfn> is...</p><a data-cite="HTML#event-loop">event loop section of HTML</a><p>This is defined in [[FETCH]] — see <a data-cite="FETCH">the Fetch Standard</a>.</p><a data-cite="HTML/webappapis.html#event-loop">event loop</a>When your spec needs to use and expose a term defined elsewhere, mark a local <dfn> with data-cite pointing to the canonical definition. This tells ReSpec where the term lives without defining it locally, and makes it linkable within your spec:
<!-- This lets other parts of your spec use [=request=] to link here -->
<p>A <dfn data-cite="FETCH#concept-request" data-export>request</dfn> is...</p>- Browse spec shortnames and anchor IDs at respec.org/xref
- Always prefer
[=term=]when the term is in the xref database —data-citeis for exceptions - When using
data-cite="SPEC"without a fragment, the spec is added to the bibliography automatically