Visit APIToGo on LinkedIn
  • Documentation
  • Components
  • Themes
Quickstart
CLI
MCP
Configuration
Look and feel
Writing
    MarkdownFrontmatterMDXAdmonitionsCode BlocksCustom pagesMermaid DiagramsStatic Files
Guides
Deployment
powered by apitogo
Writing

Mermaid Diagrams

APIToGo supports rendering Mermaid diagrams in two ways:

ApproachProsCons
Build-Time (rehype-mermaid)• Faster page loads
• No client-side JS needed
• SEO friendly
• Requires playwright
• Slower builds
• Static only
Client-Side (<Mermaid />)• Fast builds
• Can be dynamic
• No build dependencies
• Requires client-side JS
• Slight render delay

Client-Side Rendering

For the <Mermaid /> component, install the peer dependency:

TerminalCode
npm install mermaid

Then use in your MDX files (no import needed):

Code
<Mermaid chart={`graph TD; A-->B; A-->C;`} />

Outside of MDX, import from @lukoweb/apitogo/mermaid:

Code
import { Mermaid } from "@lukoweb/apitogo/mermaid";

See the Mermaid component documentation for full details.

Build-Time Rendering

  1. Install dependencies:

    TerminalCode
    npm install rehype-mermaid npm install -D playwright npx playwright install
  2. Add to apitogo.build.ts:

    apitogo.build.ts
    import rehypeMermaid from "rehype-mermaid"; export default { rehypePlugins: (plugins) => [[rehypeMermaid, { strategy: "inline-svg" }], ...plugins], };
  3. Use in markdown with code blocks:

    MDXCode
    ```mermaid graph TD; A-->B; ```
Last modified on April 17, 2026
Custom pagesStatic Files
On this page
  • Client-Side Rendering
  • Build-Time Rendering
React
React
React