Skip to content

fix(editor): show Mermaid render diagnostics - #741

Merged
murongg merged 1 commit into
v2from
fix/740-mermaid-diagnostics
Sep 20, 2026
Merged

murongg merged 1 commit into
v2from
fix/740-mermaid-diagnostics

Conversation

@murongg

@murongg murongg commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

Mermaid failures currently show only “Unable to render Mermaid diagram,” hiding the parser's explanation and line number. Show the diagnostic as plain text in both editor previews and standalone previews, with wrapping and scrolling for long messages. Clicking or pressing Enter on the editor preview still reveals the original source.

Clear error styling and stale zoom controls when rendering changes between failure and success. Disable Mermaid's fallback error SVG so the error stays inside Markra's preview. Diagnostics never modify Markdown source or interpret embedded HTML.

Refs #740. The participant-name collision is tracked separately in mermaid-js/mermaid#8280; this PR improves error reporting and does not change Mermaid syntax handling.

Validation

  • pnpm --filter @markra/editor test src/mermaid.test.ts src/mermaid.integration.test.ts src/codemirror/code-block.test.ts — 48 passed, including a real Mermaid parser failure, safe text rendering, and source-correction/theme recovery.
  • pnpm --filter @markra/app test src/components/MarkdownPreviewDocument.test.tsx src/components/MarkdownExportDocument.test.tsx src/styles.test.ts — 78 passed.
  • pnpm --filter @markra/desktop test src/quicklook/QuickLookPreview.test.tsx — 2 passed.
  • pnpm --filter @markra/editor --filter @markra/app build and pnpm --filter @markra/editor --filter @markra/app typecheck:test — passed.
  • Browser QA: verified parser line numbers, unchanged source on activation, long diagnostics in split view without horizontal overflow, recovery after correcting source, and no extra fallback error SVG in the page. Native Windows packaging was not tested locally.

@vercel

vercel Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
markra-web Ready Ready Preview Sep 20, 2026 12:39pm UTC

@murongg

murongg commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator Author

Preview of the new inline diagnostics for a participant name collision and a missing message separator:

Mermaid errors in Markra showing parser line numbers and detailed reasons

@murongg
murongg merged commit 7ed626f into v2 Sep 20, 2026
23 checks passed
@murongg
murongg deleted the fix/740-mermaid-diagnostics branch September 20, 2026 12:47

This branch was successfully deployed

1 active deployment
Preview — 9540e2b2 Deployed Sep 20, 2026 by vercel[bot]
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.

1 participant