Markdown Mermaid
Mermaid renderer for the markdown item, drawn with Pele. A fence renders as a diagram once it closes; while the source streams, or when Pele rejects it, the fence stays a code block.
A fence with the `mermaid` language becomes a diagram once its closing fence arrives; the source stays readable while the tokens stream. The diagram mounts client-side with Pele: it reads the container width, follows resizes and owns the error display. Colors are the shadcn CSS variables mapped onto `--pele-*`, so a theme switch repaints without re-rendering. Images are disabled and links keep Pele's default schemes. A diagram Pele rejects falls back to the source with a short message.
Preview
A fence with the mermaid language becomes a diagram once it closes:
flowchart LR
Source[Model output] -->|fence closes| Diagram[SVG]
Diagram --> AnswerWhile the source streams, the fence stays readable as code.
Installation
Add the item with the shadcn CLI, or copy the source manually.
pnpm dlx shadcn@latest add litingyes/blocove/markdown-mermaidRequires a shadcn/ui project set up with Base UI primitives. Blocove is developed against the b0 preset, but it installs no base config or theme tokens: your own preset, fonts and colors stay in place.
Or install from the namespace after adding the registry: npx shadcn@latest add @blocove/markdown-mermaid
This example also uses: markdown
pnpm dlx shadcn@latest add litingyes/blocove/markdowntypeset.css next to your stylesheet, import it after Tailwind and add the .typeset-docs preset. See the Rich text editor setup.API Reference
Props accepted by the exported components.
MarkdownMermaid
The Mermaid fence renderer. The shell passes `language`, `code`, `streaming` and `complete`; register it through `components.fences`. It renders the source until `complete` is set — the closing fence or the final source — then mounts Pele client-side.
Extends MarkdownCodeProps.
| Prop | Type | Default |
|---|---|---|
language | string | Required |
code | string | Required |
streaming | boolean | - |
complete | boolean | - |
className | string | - |