bug: Mermaid diagram rendering fails on Architecture Overview page
Bug Description
The Mermaid diagram in the "Architecture Overview" section fails to render, showing error:
Syntax error in text
mermaid version 10.9.1
Steps to Reproduce
- Go to Documentation → Introduction to DeepWiki-Open
- Scroll to "Architecture Overview" section
- Observe diagram rendering error
Expected Behavior
The system architecture diagram should render correctly
Screenshots
Environment
- Page: Architecture Overview
- Mermaid Version: 10.9.1
Possible Cause
- Invalid Mermaid syntax
- Version compatibility issue
- Special character encoding problem
I've created a solution: https://github.com/lvy010/mermaid-validator
This is an npm package for validating Mermaid syntax and providing better error handling.
Planning to publish to npm tomorrow after testing, then submit a PR to fix this issue.
Welcome to review
One concrete cause I hit on generated wikis (local Ollama, qwen3-coder:30b): the model writes node labels with parentheses inside square brackets, which Mermaid rejects unless the label is quoted:
graph TD
A[Frontend (Next.js)] --> B[API Layer (Express)]
Quoting fixes it: A["Frontend (Next.js)"] --> B["API Layer (Express)"]. In one 21-page wiki, 6 labels had this problem.
The diagram rules in api/services/wiki/prompts.py don't mention quoting. Two possible fixes:
- Add a prompt rule such as: "Wrap any node label containing
(,),[,],{,},:or,in double quotes, e.g.A["Frontend (Next.js)"]." - Quote such labels before rendering in
Mermaid.tsx, as a safety net for existing cached wikis.
Happy to open a PR for either if that would help.