import Card from "@mui/material/Card"; import CardContent from "@mui/material/CardContent"; import ReactMarkdown from "react-markdown"; import MermaidViewer from "./MermaidViewer"; export interface MermaidRendererProps { chart: string; } const MermaidRenderer = ({ chart }: MermaidRendererProps) => { return ( (
Not MermaidJS syntax!
), code({ node, inline, className, children, ...props }) { const match = /(```mermaid)/.exec(chart); let mermaidSyntax: string; mermaidSyntax = chart.substring(10).slice(0, -3); return match ? ( ) : (
Not MermaidJS syntax!
); }, }} />
); }; export default MermaidRenderer;