pi-mermaid-viewer

Render Mermaid diagrams from Pi user and assistant messages in the TUI

Packages

Package details

extension

Install pi-mermaid-viewer from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-mermaid-viewer
Package
pi-mermaid-viewer
Version
1.0.1
Published
May 12, 2026
Downloads
73/mo · 15/wk
Author
santychuy
License
MIT
Types
extension
Size
90.4 KB
Dependencies
2 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-mermaid-viewer

Render Mermaid fenced code blocks from Pi user input and assistant output as ASCII diagrams in the TUI.

Install

pi install npm:pi-mermaid-viewer

Then restart Pi or run:

/reload

Usage

Write or ask for a Mermaid fenced block:

```mermaid
flowchart TD
  A[User input] --> B{Contains Mermaid?}
  B -->|Yes| C[Render ASCII diagram]
  B -->|No| D[Continue normally]
```

The extension automatically renders diagrams from:

  • user input
  • assistant output

No slash command is registered.

Supported diagram types

  • graph / flowchart
  • sequenceDiagram
  • classDiagram
  • erDiagram
  • stateDiagram / stateDiagram-v2

Behavior

  • Shows full diagrams by default.
  • Chooses tighter ASCII layouts for narrow terminals.
  • Clips lines that still exceed terminal width.
  • Expanding the rendered message shows the original Mermaid source.
  • Large inputs are guarded with block, line, and character limits.

Dependencies

License

MIT