Library API
Use agentic-mermaid and agentic-mermaid/agent from local JS or TS.
Import rendering helpers from agentic-mermaid and typed parse/mutate/verify helpers from agentic-mermaid/agent. Everything runs locally with no network.
import { renderMermaidSVG, renderMermaidASCII } from 'agentic-mermaid'
import { parseRegisteredMermaid, verifyMermaid } from 'agentic-mermaid/agent'
const src = 'flowchart LR\n A[Idea] --> B[Ship]'
const svg = renderMermaidSVG(src) // also renderMermaidASCII / unicode
const parsed = parseRegisteredMermaid(src)
if (!parsed.ok) throw new Error(parsed.error.message)
const { ok, warnings } = verifyMermaid(parsed.value) // structured, tiered warnings
Render helpers return strings (SVG, ASCII, Unicode); the agent surface returns typed diagrams plus structured verify warnings. In React, call the same helpers in your component and inject the SVG — private diagrams never leave the browser or your own infrastructure. Config: supported Mermaid frontmatter and init directives are normalized before rendering; unsupported syntax is preserved or reported, never silently dropped.