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: [],
            });
        });
    };
};
