-
-
Notifications
You must be signed in to change notification settings - Fork 419
pre and code elements
Marcos Caceres edited this page Mar 27, 2026
·
16 revisions
ReSpec automatically syntax-highlights <pre> and <code> elements using highlight.js. Highlighting runs in a Web Worker — it doesn't block the main thread.
<pre>
function fetch(url) {
return new Promise(resolve => {
// ... JS is auto-detected
});
}
</pre><pre class="css">
.widget {
display: flex;
color: #336;
}
</pre>abnf, css, html, http, javascript (js), json, xml, webidl
<pre class="nohighlight">
pseudocode or plain text here
</pre>async function loadSolidity() {
const worker = await new Promise(resolve => {
require(["core/worker"], ({ worker }) => resolve(worker));
});
worker.postMessage({
action: "highlight-load-lang",
langURL: "https://example.com/highlightjs-solidity.js",
propName: "hljsDefineSolidity",
lang: "solidity",
});
return new Promise(resolve => {
worker.addEventListener("message", function listener({ data }) {
if (data.action === "highlight-load-lang" && data.lang === "solidity") {
worker.removeEventListener("message", listener);
resolve();
}
});
});
}
var respecConfig = {
preProcess: [loadSolidity],
};- Highlighting is done in a Web Worker and is non-blocking
- Language is auto-detected if no class is specified
- Use
nohighlightto disable for a block - Use
nolinksto prevent auto-linking of URLs inside code blocks (Markdown mode)
💖 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