VS Code extension that renders Mermaid diagrams from //@ tags embedded in code comments.
- Detects comments in the format
//@ID(e.g.//@Login1,//@Auth2,//@Entry1:Handle login). - Every
//@...line now receives a gutter icon for quick navigation. - Groups related tags by prefix and builds the appropriate Mermaid diagram type.
- Supports multiple diagram types declared via
//@::<type>on the first line. - Renders diagrams natively in VS Code hover (Mermaid support built into the editor).
graph LR/graph TD— flowchartsequenceDiagram— sequenceclassDiagram— class/domain modelstateDiagram-v2— state machineerDiagram— entity-relationship
- Install dependencies:
npm install - Compile:
npm run compile - Run the extension in development:
F5in VS Code (Developer: Run and Debug) - Add
//@tags in your code files:
//@::graph LR
//@Entry
class LoginController {
//@Entry1:Handle login
async handleLogin(email, password) {
//@->Auth1:Check credentials
await auth.authenticate(email, password);
//@->Error1:Invalid credentials
return error.invalidCredentials();
}
}- Hover over any
//@line to see the generated Mermaid diagram with related tags.
npm run compile
NODE_PATH=test/mocks node --test test/mad-outputs.test.mjsUpdate snapshots after changes:
NODE_PATH=test/mocks node --test-update-snapshots --test test/mad-outputs.test.mjsThis project includes .agents/skills/mad/SKILL.md, the MAD — Mermaid Auto-Doccing skill.
It defines:
//@invariants and icon rules- Supported diagram types
- Node and connection rules per diagram type
- Guidelines to keep diagrams clean and concise
- When to decouple or abstract complex diagrams
- TypeScript
- VS Code Extension API
- Mermaid (native VS Code hover rendering)
MIT