Skip to content

okforest/mermaid-syntax

errorOKForest conventions

mermaid code blocks are valid Mermaid (diagrams as code).

Mermaid is a language for writing diagrams as text, and OKForest draws mermaid code blocks as diagrams. This check parses each one with Mermaid’s own parser and reports the first syntax error, with its line; the syntax reference covers every diagram type. The CLI checks Mermaid only when mermaid is installed alongside it (diagram checks); the GitHub Action always checks it.

This file breaks the rule:

churn.md
---
type: Metric
title: Monthly churn
description: The share of customers who cancel in a month.
---
How a cancellation reaches the churn report:
```mermaid
flowchart LR
billing --> warehouse
warehouse -->
```

okforest validate reports:

churn.md
12:1 error Mermaid syntax error: Parse error on line 4: Expecting 'AMP', 'COLON', 'PIPE', 'TESTSTR', ..., got 'EOF' okforest/mermaid-syntax

Fixed:

churn.md
---
type: Metric
title: Monthly churn
description: The share of customers who cancel in a month.
---
How a cancellation reaches the churn report:
```mermaid
flowchart LR
billing --> warehouse
warehouse --> report
```