Skip to content

Fix for mermaid rendering when the diagram is initially out of view#29

Open
akh00 wants to merge 1 commit into
delphinus:mainfrom
akh00:mermaid-rendering-fix
Open

Fix for mermaid rendering when the diagram is initially out of view#29
akh00 wants to merge 1 commit into
delphinus:mainfrom
akh00:mermaid-rendering-fix

Conversation

@akh00

@akh00 akh00 commented Jul 21, 2026

Copy link
Copy Markdown

Mermaid diagrams and remote URL images render asynchronously — their placement has no .path until the render/download completes. process_one skips any placement not near the viewport, and the WinScrolled retry in place_images only re-processes placements that already have a .path. So an async-render placement below the initial viewport is never processed (skipped at setup, ignored by the scroll retry) and stays stuck on the "Rendering mermaid diagram…" placeholder forever — even after scrolling onto it. Static images with a near-top block render fine, which masks the bug

Repro: any markdown where the ```mermaid block sits below the fold; e.g. :MdRender demo inside the small terminal window

Fix: process mermaid_source/src_url placements regardless of viewport (matching what update_images already does); static local images keep the lazy-viewport optimization since they retry correctly on scroll.

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