-
-
Notifications
You must be signed in to change notification settings - Fork 420
preProcess
Marcos Caceres edited this page Mar 27, 2026
·
14 revisions
Type: Array<(config: Object, document: Document) => void | Promise<void>>
Default: []
An array of functions that run before ReSpec begins processing. Use this to fetch external data, modify the DOM before ReSpec sees it, or set up configuration that depends on async operations.
async function loadFeatureData(config, document) {
const res = await fetch("/api/features.json");
const data = await res.json();
// Make data available to the spec
window.featureData = data;
}
var respecConfig = {
preProcess: [loadFeatureData],
};function addDynamicSection(config, document) {
const section = document.createElement("section");
section.innerHTML = `<h2>Dynamic Content</h2><p>Generated at ${new Date().toISOString()}</p>`;
document.body.insertAdjacentElement("beforeend", section);
}
var respecConfig = {
preProcess: [addDynamicSection],
};- Functions are run in order, and ReSpec waits for each to complete before running the next
-
asyncfunctions are fully supported — ReSpecawaits each function - The function receives
(config, document)—configis therespecConfigobject;documentis the HTML document -
preProcessruns before structure, definitions, xref, and all other ReSpec processing — the document is still in its original source form - For post-processing after ReSpec is done, see
postProcess
💖 Support ReSpec by becoming a sponsor via Open Collective. 💖
✨ View rendered version of this documentation at https://respec.org/docs/ ✨
- Getting Started
- How Do I…
- Spec Editor's Guide
- Writing Algorithms
- WebIDL Guide
- Configuring ReSpec
- Developers Guide
- Shorthands
- addSectionLinks
- authors
- caniuse
- edDraftURI
- editors
- format (markdown)
- formerEditors
- github
- highlightVars
- isPreview
- license
- lint
- localBiblio
- logos
- maxTocLevel
- mdn
- modificationDate
- monetization
- noTOC
- otherLinks
- pluralize
- postProcess
- preProcess
- previousDiffURI
- previousMaturity
- previousPublishDate
- prevRecShortname
- prevRecURI
-
processVersion(Removed) - publishDate
- shortName
- specStatus
- subjectPrefix
- subtitle
- testSuiteURI
- xref
- additionalCopyrightHolders
-
addPatentNote(Removed) - alternateFormats
- canonicalURI
- charterDisclosureURI
- copyrightStart
- crEnd
- dark mode
- doJsonLd
- errata
- group
- implementationReportURI
- level
- noRecTrack
- prevED
- prEnd
- submissionCommentNumber
-
wg(Deprecated — usegroup) -
wgId(Deprecated — usegroup) -
wgPatentURI(Deprecated — usegroup) -
wgPublicList(Deprecated — usegroup) -
wgURI(Deprecated — usegroup)
a11ycheck-charsetcheck-internal-slotscheck-punctuationinformative-dfnlocal-refs-existno-captionless-tablesno-headingless-sectionsno-http-propsno-link-warningsno-unused-dfnsno-unused-varsprivsec-sectionwpt-tests-exist
Handled by ReSpec for you.
- conformance
- idl-index
- index
- issue-summary
- references
- tof (Table of Figures)
- data-abbr
- data-cite
- data-dfn-for
- data-dfn-type
- data-export
- data-format
- data-include
- data-include-format
- data-include-replace
- data-link-for
- data-link-type
- data-local-lt
- data-lt
- data-lt-no-plural
- data-lt-noDefault
- data-max-toc
- data-number
- data-oninclude
- data-sort
- data-tests
-
data-transform(Deprecated) - data-type
- dir
- lang