You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature] Support image-viewer interactive controls (zoom in/out, pan, lightbox) for Mermaid diagrams #5508
Support interactive image-viewer features (such as zoom in/out, pan/drag, and lightbox/full-screen preview) for rendered Mermaid diagrams in MarkText.
Problem it solves
When viewing complex or large Mermaid diagrams in MarkText, the rendered SVG is displayed at a fixed/static size within the editor. Unlike standard image previewers, users cannot zoom in to examine small text/details, zoom out for an overall view, or pan around large diagrams smoothly. This makes reading large flowcharts, sequence diagrams, or architecture diagrams difficult inside the editor.
Proposed solution
Treat rendered Mermaid diagrams similarly to images with full viewing interaction support:
Zoom & Pan Controls:
Ability to zoom in and zoom out (via mouse wheel, gesture, or toolbar buttons).
Drag to pan around the diagram when zoomed in.
A "Reset Zoom / Fit to Window" button to restore default scaling.
Lightbox / Full-screen Preview:
Double-clicking or clicking an "Enlarge / Full Screen" icon on the diagram block toolbar to open the rendered graphic in a dedicated lightbox modal window with complete zoom/pan controls.
Alternatives considered
Exporting the document to HTML/PDF or opening rendered graphics in external vector tools, which interrupts the writing and reading workflow inside MarkText.
Adjusting global editor container width settings, which changes the overall document layout rather than addressing diagram inspection specifically.
Additional context
Integrating an SVG pan/zoom or lightbox library (such as viewerjs or svg-pan-zoom) for rendered diagram blocks would provide a consistent, user-friendly image-viewing experience.
Implemented in #5554: hovering a diagram now shows a toolbar whose magnifier opens it full-screen, with wheel/button/keyboard zoom, drag or arrow-key panning, fit-to-window and actual-size, and Esc to close. The same view can save the diagram as SVG or PNG, or copy it to the clipboard as an image.
Zoom and pan live in that view rather than on the inline block on purpose — wheel-zoom on a block inside a scrolling document either hijacks the scroll or fights it.
Worth noting since svg-pan-zoom was suggested: it only operates on <svg> elements, so PlantUML (which renders to an <img> from a server) and the existing image preview would have needed a second implementation. This shares one code path with the image viewer instead.
Activity
Jocs commentedon Sep 24, 2026
Dup with #4363
Jocs commentedon Sep 25, 2026
Implemented in #5554: hovering a diagram now shows a toolbar whose magnifier opens it full-screen, with wheel/button/keyboard zoom, drag or arrow-key panning, fit-to-window and actual-size, and
Escto close. The same view can save the diagram as SVG or PNG, or copy it to the clipboard as an image.Zoom and pan live in that view rather than on the inline block on purpose — wheel-zoom on a block inside a scrolling document either hijacks the scroll or fights it.
Worth noting since
svg-pan-zoomwas suggested: it only operates on<svg>elements, so PlantUML (which renders to an<img>from a server) and the existing image preview would have needed a second implementation. This shares one code path with the image viewer instead.This will close when #5554 lands.
fix(desktop): open an oversized diagram fitted to the window (#5508)
fix(desktop): paint a background into an exported SVG (#5508)
Add a zoom/pan viewer and image export for rendered diagrams (#5554)