fix(mermaid): keep Markdown previews visible outside edit mode - #1505
Draft
parker2024-boom wants to merge 2 commits into
Draft
parker2024-boom wants to merge 2 commits into
parker2024-boom wants to merge 2 commits into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mermaid diagrams can render while their code block is being edited, then disappear when returning to the Markdown preview. On Intel macOS 13.7.8, the affected SVGs have a
0 × 0bounding box in the native WKWebView.The standalone
.mmdadapter's stylesheet uses the same.mermaid-previewclass as Markdown code-block widgets. Its pane layout leaksheight: 100%,width: auto, andmax-height: 100%into those widgets. The live editing preview uses different classes, which explains why editing temporarily makes the diagram visible.What Changed
:not(:where(.code-block-preview)). Markdown previews keep their existing layout; standalone.mmdpanes retain theirs regardless of stylesheet import order.:where()so the exclusion adds no specificity. The standalone empty and invalid modifiers must still override the base rules.codePreviewcoordination module, using the production Mermaid renderer, SVG sanitizer, stylesheets, and Panzoom. It covers flowchart/cycle/sequence visibility across edit/view states and a narrow container, standalone pane sizing, and empty/invalid states.The change does not alter Mermaid syntax, the shared theme/fallback styling, or diagram rendering logic.
Reproduction
A native-app differential check reintroduced only the original leaking layout declarations: all three SVGs collapsed to
0 × 0. Removing those declarations restored visible diagrams, including after entering and leaving editing. The document's bytes were unchanged.Validation
pnpm check:fast: passed (43 test files, 462 tests).pnpm build: passed.pnpm lint:test-types: passed withNODE_OPTIONS=--max-old-space-size=4096; no baseline changes. The default heap ran out of memory on this host.pnpm check:predelta: initially 46/49 gates passed. The introduced cross-plugin test import was fixed by moving the integration test tocodePreview;lint:depsnow passes. The other failures were this macOS host's BSD grep path output and unsupported inheritedC.UTF-8locale. With GNU grep andLC_ALL=en_US.UTF-8, the unchanged console lint passes and the two failed gate-test files pass all 73 cases. No gate or baseline was relaxed.2d3903cb2(v0.9.92). Finalpnpm check:all: passed (exit 0): all static checks; 137 gate files / 3,520 tests; 2,051 application files / 44,440 tests; MCP server 34 files / 749 tests; content server 17 files / 271 tests; coverage thresholds, production build, eager-import lint, and bundle-size limits. Existing skips: 2 gate cases, 2 application files / 83 cases, and 1 MCP case. Application coverage: 95.86% statements, 92.47% branches, 95.30% functions, 96.82% lines. An earlier check on the previous base was interrupted and is not counted as a pass.Remaining review and platform limits
This is a draft PR. Playwright's WebKit installer refuses macOS 13 (
Playwright does not support webkit on mac13), so the committed browser regression suite has not run here. Native WKWebView and the actual Tauri app provide local layout evidence, but the browser suite still needs a supported host.The local JEV automated patch review remained
escalatefor test-gap/blast-radius confidence after two evidence supplements. Its completion claims were verified; that is not an overall patch approval. The unresolved review status is retained rather than represented as a green gate.No private document contents or user paths are included in this PR. The regression diagrams are synthetic.
Policy Gates (Required)
Type of Change
PR Checklist