MCPcopy Create free account
hub / github.com/SyntaxUI/syntaxui / rehypeParseCodeBlocks

Function rehypeParseCodeBlocks

src/mdx/rehype.mjs:7–18  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5import { visit } from 'unist-util-visit'
6
7function rehypeParseCodeBlocks() {
8 return (tree) => {
9 visit(tree, 'element', (node, _nodeIndex, parentNode) => {
10 if (node.tagName === 'code' && node.properties.className) {
11 parentNode.properties.language = node.properties.className[0]?.replace(
12 /^language-/,
13 '',
14 )
15 }
16 })
17 }
18}
19
20function rehypeSlugify() {
21 return (tree) => {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected