Why mermaid, not an image
A text diagram lives in the diff, so a reviewer sees what the picture changed; fixing a wrong label is a one-word edit, not a request for the source file; the text is searchable and readable by a screen reader; and it follows the site's light/dark theme. A PNG does none of those four.
External images are also blocked because of bait-and-switch: approving a clean image and then replacing the file on your own server routes around the whole review gate with one scp.
Data flow — for experience and incident posts
flowchart LR U[User] --> A[API] A -->|"fetch(url), unchecked"| M[169.254.169.254] M -->|"temporary credentials"| ASSRF into the metadata endpoint: the flaw is the API trusting a user-supplied URL.
Wrap labels containing special characters in quotes: A[Client] -->|"fetch(url)"| B.
Timeline — incident posts
timeline title Key leaked through CI logs 09:12 : Detected via GitHub alert 09:40 : Key rotated, artifacts locked 11:05 : Older artifacts rescanned 14:00 : Post-mortem, scan added before uploadFour moments, and only the last one fixes the cause.
Sequence — token, callback and webhook flows
sequenceDiagram participant B as Browser participant W as Web (BFF) participant A as API B->>W: POST /auth/login W->>A: /v1/auth/login A-->>W: access + refresh W-->>B: Set-Cookie (HttpOnly) Note over B,W: Tokens never reach the browserThe refresh token stays server-side; the browser only holds a cookie.
Before / after the fix — patch posts
flowchart TD subgraph Before A1[GET /orders/42] --> B1[No ownership check] --> C1[Someone else's order] end subgraph After A2[GET /orders/42] --> B2["WHERE user_id = @subject"] --> C2[404] endBOLA and its fix. 404, not 403 — a 403 confirms the id exists.
Four common errors
| Error | What you see | Fix |
|---|---|---|
| No diagram type | "No diagram type detected" | First line must be flowchart LR, sequenceDiagram, timeline… |
Unquoted (, :, , in a label | "Parse error on line N" | Wrap the label in "…" |
| Wrong arrow | Nothing renders | --> in flowcharts, ->> in sequences |
Missing end | Error on the last line | Every subgraph needs an end |
Three limits and one warning
- At most 10 diagrams per post, 120 lines per diagram, and a 2 second render timeout.
- Mermaid's
clickandhrefdirectives are stripped — they are script and link injection
through the back door of a "diagram" block.
- A diagram should carry a one-line caption. That caption is the text description for people who
cannot see the picture, and it is what search indexes. Missing it is a warning, not a block.