ClaudeMods
☰
EN
● — online · Views — times
SponsorsSubmit a project
GitHub repositories · by WhiteKr

mermaid

A function-hook plugin that renders ```` ```mermaid ```` code blocks in Claude responses as Unicode box diagrams in the terminal transcript. Targets mermaid code emitted by skills like `/show-me`.

Translated

About this mod

mermaid

A function-hook plugin that renders ```mermaid code blocks in Claude responses as Unicode box diagrams in the terminal transcript. Targets mermaid code emitted by skills like /show-me.

Installation

/plugin marketplace add WhiteKr/whitekr-claude-plugins
/plugin install mermaid@whitekr-claude-plugins

During development, load it with claude --plugin-dir <this folder>.

Behavior

  • Hooks AssistantMessage in ui.render and replaces closed ```mermaid fences with the output of the beautiful-mermaid ASCII renderer. Saved messages (ctrl+o) stay unchanged; only the screen changes.
  • Cases where the original is kept: parse failure, diagram width exceeds terminal width, or the fence is not yet closed (streaming in progress).
  • Literal \n inside labels is replaced with a space (if the renderer draws it as a line break, the box breaks).
  • Supported diagrams follow the scope supported by the beautiful-mermaid ASCII renderer (flowchart, sequence, class, ER, state, etc.).

Options

In /config under plugin items, or settings pluginConfigs.mermaid.options:

  • useAscii (boolean, default false): Draw with pure ASCII (+-|>) instead of box characters. Turn this on when the terminal or font renders ambiguous-width characters like ─│▶ as 2 cells, causing lines to misalign.

Development

hooks/hooks.js is the esbuild bundle of src/hooks.js plus the beautiful-mermaid ASCII path, and is committed (marketplace installs use it as-is without a build).

npm i
npm test   # build + test/hooks.test.mjs

Installation

Check the author's README for the marketplace and plugin name first. Commands may change as the repository evolves.

claude plugin marketplace add WhiteKr/claude-plugin-mermaid
claude plugin install mermaid@whitekr-claude-plugins
Original text / README

mermaid

Claude 응답의 ```mermaid 코드 블록을 터미널 transcript에서 유니코드 박스 다이어그램으로 바꿔 그리는 function-hook 플러그인. /show-me 같은 스킬이 내는 mermaid 코드가 대상이다.

설치

/plugin marketplace add WhiteKr/whitekr-claude-plugins
/plugin install mermaid@whitekr-claude-plugins

개발 중에는 claude --plugin-dir <이 폴더> 로 로드한다.

동작

  • ui.render 의 AssistantMessage 를 훅해 닫힌 ```mermaid 펜스를 beautiful-mermaid ASCII 렌더러로 그린 결과로 치환한다. 저장된 메시지(ctrl+o)는 바뀌지 않고 화면만 바뀐다.
  • 원문을 유지하는 경우: 파싱 실패, 다이어그램 폭이 터미널 폭을 넘김, 펜스가 아직 안 닫힘(스트리밍 중).
  • 라벨 안의 리터럴 \n 은 공백으로 바꾼다(렌더러가 줄바꿈으로 그리면 박스가 깨짐).
  • 지원 다이어그램은 beautiful-mermaid ASCII 렌더러가 지원하는 범위(flowchart, sequence, class, ER, state 등)를 따른다.

옵션

/config 의 plugin 항목 또는 settings pluginConfigs.mermaid.options:

  • useAscii (boolean, 기본 false): 박스 문자 대신 순수 ASCII(+-|>)로 그린다. 터미널·폰트가 ─│▶ 같은 ambiguous-width 글자를 2칸으로 그려 줄이 어긋날 때 켠다.

개발

hooks/hooks.js 는 src/hooks.js + beautiful-mermaid ASCII 경로를 esbuild 로 묶은 산출물이며 커밋 대상이다(마켓플레이스 설치는 빌드 없이 그대로 쓴다).

npm i
npm test   # build + test/hooks.test.mjs

Similar projects