Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
raw
history blame
637 Bytes
import { visit } from 'unist-util-visit'
/** @type {import('unified').Plugin<[], import('mdast').Root>} */
export default function parseCallouts() {
return (tree, file) => {
visit(tree, node => {
if (
node.type === 'textDirective' ||
node.type === 'leafDirective' ||
node.type === 'containerDirective'
) {
if (
node.name !== 'danger' &&
node.name !== 'warning' &&
node.name !== 'success' &&
node.name !== 'note'
) {
return
}
node.data = node.data ?? {}
node.data.hName = node.name
}
})
}
}