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

Function rehypeSlugify

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

Source from the content-addressed store, hash-verified

18}
19
20function rehypeSlugify() {
21 return (tree) => {
22 let slugify = slugifyWithCounter()
23 visit(tree, 'element', (node) => {
24 if (node.tagName === 'h2' && !node.properties.id) {
25 node.properties.id = slugify(toString(node))
26 }
27 })
28 }
29}
30
31function rehypeAddMDXExports(getExports) {
32 return (tree) => {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected