1
80
近 7 天 14
25.8
生态多维模型
5 个月前
2026-03-15
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@rolled-potatoes/opencode-mermaid@0.2.0"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@rolled-potatoes/opencode-mermaid@0.2.0"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D @rolled-potatoes/opencode-mermaidopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
An OpenCode plugin that renders Mermaid diagrams in your browser.
Whenever the AI writes a mermaid code block, it automatically calls render_mermaid to open the diagram in your default browser. Multiple diagrams within the same session are accumulated in a single HTML file.
Install
Add the package name to the plugin array in your opencode.json:
{
"plugin": ["@rolled-potatoes/opencode-mermaid"]
}
OpenCode will install it automatically on next start.
Features
- Opens diagrams in the browser via a local HTML file (
/tmp/mermaid-<sessionID>.html) - Accumulates all diagrams from a session in one file — just refresh the tab
- Collapsible source view for each diagram
- Cross-platform: macOS (
open), Linux (xdg-open), Windows (start) - Uses Mermaid.js v11 via CDN — no build step needed
Supported diagram types
flowchart, sequence, class, pie, gantt, state, ER, mindmap, timeline, git graph, and anything else Mermaid supports.
License
MIT