UNPKG

@alauda/doom

Version:

Doctor Doom making docs.

23 lines (22 loc) 674 B
import { visit } from 'unist-util-visit'; export const remarkMermaid = function () { return (root) => { visit(root, 'code', (node, index, parent) => { if (!parent || node.lang !== 'mermaid') { return; } parent.children.splice(index, 1, { type: 'mdxJsxFlowElement', name: 'Mermaid', attributes: [ { type: 'mdxJsxAttribute', name: 'children', value: node.value, }, ], children: [], }); }); }; };