Zudoku supports rendering Mermaid diagrams in two ways:
| Approach | Pros | Cons |
|---|---|---|
| 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:
Code
Then use in your MDX files (no import needed):
Code
Outside of MDX, import from zudoku/mermaid:
Code
See the Mermaid component documentation for full details.
Build-Time Rendering
-
Install dependencies:
Code -
Add to
zudoku.build.ts:zudoku.build.ts -
Use in markdown with code blocks:
Code
Last modified on