How Do I - speced/respec GitHub Wiki
Common tasks for ReSpec spec editors.
Use the [= term =] shorthand after enabling xref:
var respecConfig = {
xref: "web-platform", // or true, or ["FETCH", "DOM"]
};<p>Run these steps to [=fetch=] a resource.</p>
<p>Fire an [=event=] named "load" at the {{Window}} object.</p>Browse available terms at respec.org/xref.
<p>The <dfn data-export>fetch</dfn> algorithm takes a request...</p>The data-export attribute makes the term available in the xref database after your spec is crawled (usually ~6 hours after publication). See data-export.
As described in <a href="#authentication"></a>.
<!-- Empty href auto-fills with "§ N Authentication" -->This follows [[!FETCH]] (normative).
See also [[INFRA]] (informative).The ! prefix makes it normative. See the Shorthands Guide.
Use data-cite:
<a data-cite="FETCH#concept-request">request</a>
<a data-cite="!HTML#event-loop">event loop</a><section data-dfn-for="Widget" data-link-for="Widget">
<h2>The <code>Widget</code> interface</h2>
<pre class="idl">
[Exposed=Window]
interface Widget {
readonly attribute DOMString name;
undefined update(optional WidgetOptions options = {});
};
</pre>
<p>The <dfn>name</dfn> attribute returns the widget's name.</p>
<p>The <dfn>update()</dfn> method updates the widget.</p>
</section>See the WebIDL Guide.
var respecConfig = {
caniuse: "payment-request",
};var respecConfig = {
mdn: true, // uses shortName as key
};<section data-include="sections/api.html"></section><section data-include="sections/intro.md"
data-include-format="markdown"></section>Requires HTTP — see data-include.
<section class="informative">
<h2>Use Cases</h2>
<p>This section is non-normative.</p>
</section>ReSpec adds "This section is non-normative." automatically.
<div class="note">
<p>Implementations should handle this case carefully.</p>
</div><p class="ednote">TODO: clarify this algorithm.</p><ul data-sort>
<li>Zebra</li>
<li>Apple</li>
<li>Mango</li>
</ul>See data-sort.
<p data-tests="test-basic.https.html,test-error.html">
The user agent MUST reject the Promise if...
</p>Requires testSuiteURI in config. See data-tests.
<table data-lint-ignore="no-captionless-tables">
<tr><td>data without caption</td></tr>
</table>See lint-ignore.
async function fetchData(config, document) {
// runs before ReSpec
}
function cleanup(config, document) {
// runs after ReSpec
}
var respecConfig = {
preProcess: [fetchData],
postProcess: [cleanup],
};See preProcess and postProcess.
await document.respec.ready;
// document is now fully processedSee document.respec.
Click the ReSpec pill (top-right corner) → Save as HTML.
This produces a standalone HTML file with all scripts removed — suitable for W3C publication.
Alternatively, calling await document.respec.toHTML() outputs the same HTML as a string programmatically.