mermaid-render Render Mermaid diagrams as SVG
Examples
Render a Mermaid flowchart as SVG
Usage
"graph TD
A[Start] --> B{Decision}
B -->|Yes| C[Do someth..." | mermaid-render Visualize a sales pipeline workflow as a diagram
Usage
"graph LR
Lead --> Qualified
Qualified --> Proposal
Pro..." | mermaid-render Create a user flow decision tree for a product spec
Usage
"graph TD
A[User visits site] --> B{Logged in?}
B -->|Yes..." | mermaid-render View source
async (input)=>{
if (!input.trim()) return "";
try {
const mermaid = await import('mermaid').then(async (m)=>{
await m.__tla;
return m;
});
mermaid.default.initialize({
startOnLoad: false,
theme: "dark"
});
const id = `mermaid-pipr-${Date.now()}`;
const { svg } = await mermaid.default.render(id, input);
return svg;
} catch (e) {
return `Error: ${e.message}`;
}
}