Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By galElmalahv0.3.2MITIn 2 marketplaces
Mermaid diagrams in Claude Code: every ```mermaid block Claude writes is drawn as box art, in colour, right where the fence was in the transcript. Needs function hooks (early access) and an interactive terminal.
Trending plugins
7-day copy clicks
Code that runs inside Claude Code on every session, as you, unsandboxed.
1 critical to review before installing
JavaScript or TypeScript that runs inside Claude Code as you, unsandboxed. Read from its source, it makes none of the file, program, network, tool or prompt calls we list.
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
2 marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Mermaid diagrams in Claude Code. Every ```mermaid block Claude writes
is drawn as box art, in colour, right where the fence was in the transcript.
Nothing costs a token: the plugin draws locally, and nothing else appears on
screen — no pane, no buttons.
❯ how does a prompt become a reply?
⏺ A prompt flows through understanding and a decision point before a reply.
┌────────┐ ┌────────────┐ ◇────────────◇ ┌───────┐
│ │ │ │ │ │ │ │
│ Prompt ├────►│ Understand ├────►│ Use Tools? ├─Yes►│ Reply │
│ │ │ │ │ │ │ │
└────────┘ └────────────┘ ◇────────────◇ └───────┘
Flowcharts, state, sequence, class and ER diagrams and xy charts are drawn;
other kinds (gantt, pie, mindmap, …) keep their fence. A top-down flowchart
or state diagram is laid out left to right when that fits and loses nothing
(rows are dear in a terminal: 5 rows instead of 30), and a state diagram's
[*] start and end, which the renderer draws as empty boxes, are left out.
A mod: a plugin built on Claude Code function hooks, TypeScript that runs inside Claude Code's own process. Early access, so it needs the environment variable below and the API can change between releases.
CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1./mermaid ascii on for one that does not). Nothing draws in
claude -p.Turn function hooks on, in ~/.claude/settings.json:
{ "env": { "CLAUDE_CODE_ENABLE_FUNCTION_HOOKS": "1" } }
Or for one session: CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude.
Load the plugin from a clone (the repo's own .claude/settings.json
sets the variable for sessions started inside it):
git clone https://github.com/galElmalah/claude-mods
cd claude-mods
claude --plugin-dir claude-mermaid
Or install it from the repo's marketplace, gal-mods:
claude plugin marketplace add galElmalah/claude-mods
claude plugin install mermaid-draw@gal-mods
Ask Claude for a diagram. It is drawn in the reply.
Upgrading from claude-mermaid@claude-mods? Follow the
migration instructions.
| command | what it does |
|---|---|
/mermaid | shows the current settings |
/mermaid ascii on|off | plain `+-- |
/mermaid color on|off | borders cyan, arrows yellow, lines dim (default on) |
/mermaid lr on|off | lay top-down flowcharts and state diagrams out left to right when nothing is lost (default on) |
/mermaid reset | the defaults again |
A setting redraws the diagrams already on screen. Settings are kept in the plugin's store across sessions.
hooks/register.ts is the hooks module. It hooks ui.render of
AssistantMessage: with colour on, on the terminal, it returns a tree of its
own (Markdown for the prose, one Text per diagram line, the colours as
props on its spans), since a rewritten props.text may carry no escape
sequence from Claude Code 2.1.287 on; otherwise it swaps each closed mermaid
fence for a text fence of plain art. It also hooks command.run for
/mermaid.hooks/diagrams.ts is the pure part: finding fences, rendering, choosing
the sideways layout (kept only when every word of the top-down render
survives, since the renderer can overwrite the label of an edge that runs
back the other way), fitting to a width, serializing. bun test covers it.hooks/vendor/mermaid-ascii.js is beautiful-mermaid's
ASCII renderer bundled by scripts/build-vendor.mjs (hooks modules run
with no Node and cannot import packages). The renderer only emits ANSI, so
it is run in truecolor against a theme of sentinel colours and the escapes
are decoded back into roles (border, line, arrow, text), then coloured for
the terminal's own 16-colour palette so light and dark themes both read.Map maximum size exceeded, which would burn the hook's whole
budget. The vendored copy caps the search and falls back to a straight
segment, so the same graph draws in ~60 ms. Rendered art is cached per
source and glyph set; a hook settles in a few ms after the first draw.Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub galelmalah/claude-mods --plugin mermaid-draw