forEachCodeBlock
forEachCodeBlock<
T>(root,callback):PrismCodeBlock[]
Defined in: client/code-block.ts:34
Runs a callback function for each code block under the root in document order. If a callback has previously been run for a code block, it’s skipped.
The callback function takes the code block as the first argument. The second parameter is any additional properties passed when the code block was created. These options were stringified to JSON and parsed.
Type Parameters
Section titled “Type Parameters”T extends object
Parameters
Section titled “Parameters”Root to search for code blocks under.
Element | Document
callback
Section titled “callback”(codeBlock, options) => void
Function to run for each code block.
Returns
Section titled “Returns”An array with all visited code blocks in document order.