import { useColorScheme } from "@mui/joy"; import mermaid from "mermaid"; import { useEffect, useRef } from "react"; interface Props { content: string; } const MermaidBlock: React.FC = ({ content }: Props) => { const { mode } = useColorScheme(); const mermaidDockBlock = useRef(null); mermaid.initialize({ startOnLoad: false, theme: mode }); useEffect(() => { if (!mermaidDockBlock.current) { return; } // Render mermaid when mounted. mermaid.run({ nodes: [mermaidDockBlock.current], }); }); return (
      {content}
    
); }; export default MermaidBlock;