MCPcopy Index your code
hub / github.com/nodejs/nodejs.org / isCodeBlock

Function isCodeBlock

packages/rehype-shiki/src/plugin.mjs:50–54  ·  view source on GitHub ↗

* Checks if the given node is a valid code element. * * @param {import('unist').Node} node - The node to be verified. * * @return {boolean} - True when it is a valid code element, false otherwise.

(node)

Source from the content-addressed store, hash-verified

48 * @return {boolean} - True when it is a valid code element, false otherwise.
49 */
50function isCodeBlock(node) {
51 return Boolean(
52 node?.tagName === 'pre' && node?.children[0].tagName === 'code'
53 );
54}
55
56/**
57 * @param {import('#rs/index.mjs').HighlighterOptions & { highlighter: import('#rs/highlighter.mjs').SyntaxHighlighter }} options

Callers 1

rehypeShikijiFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected