import { visit } from "unist-util-visit";


export function remarkMermaid() {
    return (tree) => {
        visit(tree, "code", (node) => {
            if (node.lang === "mermaid") {
                // 将 mermaid 代码块转换为自定义节点类型
                node.type = "mermaid";
                node.data = {
                    hName: "div",
                    hProperties: {
                        className: ["mermaid-container"],
                        "data-mermaid-code": node.value,
                    },
                };
            }
        });
    };
}