Mermaid Syntax Basics
Mermaid diagrams start with type declaration: graph TD (flowchart top-down), graph LR (left-right), sequenceDiagram, gantt, classDiagram, stateDiagram, erDiagram, pie. Nodes defined as id[text] or id(text) for different shapes: [] rectangle, () rounded, {} rhombus, (()) circle, [[]] subroutine. Connections use arrows: --> (solid), -.-> (dotted), ==> (thick), --text--> (labeled). Subgraphs group nodes: subgraph title ... end. Styling via %%{init: {'theme':'dark'}}%% or inline style id:::className. Comments start with %%. Special characters escaped or quoted. Indentation for readability.