opencode-mermaid-formatter
v0.1.0
Published
Mermaid diagram to ASCII art formatter plugin for OpenCode
Maintainers
Readme
opencode-mermaid-formatter
Mermaid diagram to ASCII art formatter plugin for OpenCode.
Converts mermaid code blocks into beautiful ASCII/Unicode art diagrams using mermaid2term.
Installation
npm install opencode-mermaid-formatterUsage
Add the plugin to your .opencode/opencode.jsonc:
{
"plugins": ["opencode-mermaid-formatter"]
}Restart OpenCode, and any mermaid diagrams generated by the AI will automatically be converted to ASCII art.
Example
When the AI generates a mermaid diagram like:
```mermaid
graph TD
A[Start] --> B{Decision}
B -->|Yes| C[Do Something]
B -->|No| D[Skip]
```It will be automatically converted to:
┌───────┐
│ │
│ Start │
│ │
└───────┘
│
┌─────▼────┐
│ │
│ Decision │
│ │
└─────────────────┐No
│ Yes │
┌───▼────────┐ │
│ │ │
│Do Something│ │
│ │ │
└────────────┘ │
┌───▼──┐
│ │
│ Skip │
│ │
└──────┘Supported Diagram Types
- Flowcharts -
graph TD,graph LR,graph TB,graph RL,graph BT - Sequence diagrams -
sequenceDiagram
Flowchart Features
- Directions: TD/TB (top-down), LR (left-right), RL (right-left), BT (bottom-top)
- Node shapes: rectangles
[], rounded(), diamonds{} - Edge types: solid
-->, dotted-..->, thick==> - Edge labels:
-->|label| - Cycles and back-edges
Requirements
- OpenCode >= 1.0.137
- Node.js >= 18.0.0
License
MIT © watzon
Links
- GitHub Repository
- npm Package
- mermaid2term - The rendering engine
- Report Issues
