Mermaid diagram generation within the AI learning system, specifically addressing parsing compatibility issues between `mermaid-cli` and Obsidian.
Raw Developer Origin & Technical Request
GitHub Issue
Aug 25, 2026
## Problem
Some diagrams generated by `mermaid-maker` render fine via `mermaid-cli` (puppeteer/Chrome) but fail in Obsidian with:
```
Error parsing Mermaid diagram!
Parse error on line 5:
... D1[D1 缩放点积 /sqrt(dk)] --> D3 U2
-----------------------^
Expecting 'SQE', 'DOUBLECIRCLEEND', ... got 'PS'
```
Minimal repro: any flowchart node label containing `/`, `(`, `)` without quotes, e.g. `D1[D1 缩放点积 /sqrt(dk)]`, plus a stray token after an edge (`--> D3 U2`).
## Root cause
- `visual-tools` uses `@mermaid-js/mermaid-cli@11.4.2` (lenient) while Obsidian bundles an older/stricter Mermaid. Validity in pi does not guarantee validity in Obsidian.
- Unquoted labels with reserved chars (`/`, `(`, `)`, `:`, `;`) are parsed as tokens. The stray `U2` after the edge then triggers `Expecting 'SQE' got 'PS'`.
- No pre-publish validation against Obsidian-compatible parsing.
## Proposed fix
1. Enforce quoted labels in `mermaid-maker` prompt: labels with non-alphanumerics MUST use `["..."]`.
2. Add lint in `extensions/visual-tools/tools/mermaid_tools.ts:write_mermaid` — call `mermaid.parse()` (or regex check) and return a structured error so the maker can `edit_mermaid` and retry.
3. Optional second-pass validation with the same Mermaid version Obsidian uses, with a compatibility note in README.
## Value / Cost
- Value: **High** — breaks core learning flow, high repro rate for CJK labels.
- Cost: **Low-Medium** — 1-2 files, ~0.5 day, no new deps.
## Repro
```mermaid
graph TD
...
Developer Debate & Comments
No active discussions extracted for this entry yet.
Adjacent Repository Pain Points
Other highly discussed features and pain points extracted from amosblomqvist/learn.
License
Frequently Asked Questions
Market intelligence mapped to Mermaid diagram generation within the AI learning system, specifically addressing parsing compatibility issues between `mermaid-cli` and Obsidian..
What is the technical positioning of Mermaid diagram generation within the AI learning system, specifically addressing parsing compatibility issues between `mermaid-cli` and Obsidian.?
What are the foundational technologies related to Mermaid diagram generation within the AI learning system, specifically addressing parsing compatibility issues between `mermaid-cli` and Obsidian.?
Engagement Signals
Cross-Market Term Frequency
Quantifies the cross-market adoption of foundational terms like PS and lint by tracking occurrence frequency across active SaaS architectures and enterprise developer debates.
SaaS Metrics