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

fix: handle errors appended to body by mermaid #182

Closed JoshStern closed 1 year ago

JoshStern commented 1 year ago

Overview

For some errors the div + svg added by mermaid is not cleaned up and an error is thrown here. This leads to a list of permanent error messages that grows until the preview is refreshed.

Repro Steps

Open a markdown document with the following content:

```mermaid
flowchart


Add and remove newlines and the error svgs will grow. There is also no error info.

<img width="738" alt="image" src="https://user-images.githubusercontent.com/10948202/222986263-e4a3bb9a-bb14-4b74-b975-c0bd796f5d68.png">
<img width="446" alt="image" src="https://user-images.githubusercontent.com/10948202/222986315-a7f2f8ee-7ff6-4941-a0b5-c0f8f6971dac.png">

## After fix
Errors should not grow, and fully disappear when resolved.

<img width="480" alt="image" src="https://user-images.githubusercontent.com/10948202/222986362-9ec9a9de-f094-41ef-8eee-bd827a684da8.png">

Thank you for putting this extension together! It's been super useful.
mjbvz commented 1 year ago

Thanks!

mjbvz commented 1 year ago

Published as 1.17.6