mjbvz / vscode-markdown-mermaid

Adds Mermaid diagram and flowchart support to VS Code's builtin markdown preview
https://marketplace.visualstudio.com/items?itemName=bierner.markdown-mermaid
MIT License
633 stars 114 forks source link

Mermaid syntax errors result in large diagrams reducing size dramatically to display the error condition and then the linked markdown source code editor scrolls unexpectedly #208

Open QuintinWillison opened 1 year ago

QuintinWillison commented 1 year ago

This is perhaps the most annoying thing I've found with this extension so far.

Would it be possible, perhaps, for you to cache the last successfully rendered diagram width and height and then honour that size when rendering the error condition?

Those error conditions are always transitory in nature, quickly fixed by the human who's editing the code.

The unexpected behaviour I'm seeing is that my markdown preview is seemingly triggered the markdown source code editor to scroll 'madly' when it changes size continuously.

Same vibes as when you load a web page and images don't know their width and height beforehand, if you get my drift.

QuintinWillison commented 1 year ago

Most of my day today has been spent working on a Mermaid document embedded in Markdown with VS Code, and this issue's been doing my head in. For others facing the same frustration there's a VS Code setting which you can disable which stops the preview from influencing the editor scroll position:

Screenshot 2023-06-30 122100

Not a feature I was particularly relying upon in my workflow anyway.

Thanks to this Stackoverflow answer.

NoCtrlZ1110 commented 4 months ago

@QuintinWillison Thank you so much! That's exactly what I am trying to do, but I don't know how to configure it.