Skip to content

Add mermaid diagram sanitization to wiki push step#284

Merged
dsyme merged 2 commits intomainfrom
copilot/fix-rendering-issues-mermaid-diagrams
Mar 19, 2026
Merged

Add mermaid diagram sanitization to wiki push step#284
dsyme merged 2 commits intomainfrom
copilot/fix-rendering-issues-mermaid-diagrams

Conversation

Copy link
Contributor

Copilot AI commented Mar 18, 2026

GitHub's wiki mermaid renderer rejects two syntax patterns the AI model occasionally generates, causing "Unable to render rich display" errors. This adds a post-processing sanitization step that fixes these patterns before committing wiki pages.

Changes

  • New "Sanitize Mermaid diagrams" step in the push-wiki safe-output job, running between "Write wiki pages" and "Commit and push"
    • Strips backtick markdown-string syntax from node labels (A["`text`"]A["text"])
    • Handles embedded \n escape sequences within backtick labels (A["`prefix`\nextra"]A["prefix extra"])
    • Replaces any remaining \n escape sequences in labels with spaces
    • Reports which files were modified

Example

Before (causes lexer error):

flowchart LR
  core["`@react-term/core`\nCellGrid, Buffer, VTParser"] --> web
Loading

After sanitization:

flowchart LR
  core["@react-term/core CellGrid, Buffer, VTParser"] --> web
Loading

This acts as a reliable safety net regardless of what the model generates, since the existing self-review checklist instructions alone are insufficient to prevent the issue.


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix rendering issues in mermaid diagrams in Agentic Wiki Writer Add mermaid diagram sanitization to wiki push step Mar 18, 2026
Copilot AI requested a review from dsyme March 18, 2026 20:25
@dsyme dsyme marked this pull request as ready for review March 19, 2026 00:46
@dsyme dsyme merged commit d5a8127 into main Mar 19, 2026
1 check passed
@dsyme dsyme deleted the copilot/fix-rendering-issues-mermaid-diagrams branch March 19, 2026 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rendering issues in mermaid diagrams in Agentic Wiki Writer

2 participants