()
| 5 | import { visit } from 'unist-util-visit' |
| 6 | |
| 7 | function 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 | |
| 20 | function rehypeSlugify() { |
| 21 | return (tree) => { |
nothing calls this directly
no outgoing calls
no test coverage detected