Skip to content

Commit da1686f

Browse files
Copilotmrjf
andauthored
Fix rendering issues in mermaid diagrams in Agentic Wiki Writer (#260)
* Initial plan * Fix mermaid diagram rendering: prohibit backtick strings and \\n in labels Co-authored-by: mrjf <180956+mrjf@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mrjf <180956+mrjf@users.noreply.github.com> Co-authored-by: Russell Horton <mrjf@github.com>
1 parent b40c14a commit da1686f

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

workflows/agentic-wiki-writer.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,13 @@ Diagram type by use case: `flowchart LR` for architecture/data flow; `sequenceDi
494494

495495
Syntax rules: Always specify direction (`LR` or `TD`). Wrap labels containing special characters in double quotes: `A["MyClass::method()"]`. One relationship per line. Use subgraphs sparingly (max one level deep). Add a brief sentence before the diagram explaining what it shows.
496496

497+
**Critical mermaid restrictions** — GitHub's renderer is strict. Violating these causes "Unable to render rich display" errors:
498+
499+
- **No backtick strings** — Do NOT use the backtick/markdown-string syntax inside node labels: `` A["`label`"] `` is invalid. Use plain text or double-quoted strings only: `A["label"]`.
500+
- **No `\n` in labels** — Do NOT use `\n` escape sequences inside node labels. They are not rendered as newlines and cause lexer errors. Keep labels to a single line. If a label is too long, shorten it or split the node into two nodes.
501+
- **No special characters unquoted** — Any label containing `@`, `(`, `)`, `:`, `/`, `<`, `>`, or other non-alphanumeric characters must be wrapped in double quotes.
502+
- **Test mentally before writing** — Before including a diagram, verify each node label is either plain alphanumeric text or a properly double-quoted string with no escape sequences.
503+
497504
```mermaid
498505
flowchart LR
499506
A[Input] --> B[Process] --> C[Output]
@@ -577,7 +584,13 @@ Before finalizing each page, check for these issues and fix them:
577584

578585
5. **Accuracy** — Content matches what the source code actually does. No fabricated features or APIs.
579586

580-
6. **Structural consistency** — Similar sections across pages use the same structure and formatting patterns.
587+
6. **Mermaid diagram syntax** — For every mermaid diagram, verify:
588+
- No backtick/markdown-string notation inside labels (`` A["`text`"] `` → invalid)
589+
- No `\n` escape sequences inside labels (`A["line1\nline2"]` → invalid; shorten the label instead)
590+
- All labels with special characters (`@`, `(`, `)`, `:`, `/`) are wrapped in double quotes
591+
- Fix any violation by simplifying the label to plain text or a valid double-quoted string
592+
593+
7. **Structural consistency** — Similar sections across pages use the same structure and formatting patterns.
581594

582595
---
583596

0 commit comments

Comments
 (0)