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
630 stars 112 forks source link

Elk renderer not working on 1.22.0 when a subgraph is empty #249

Closed Alexandre-SCHOEPP closed 3 months ago

Alexandre-SCHOEPP commented 3 months ago

Hi !

As I mentioned in #223 I have an issue with this extension. When using the elk renderer when a subgraph is empty, I get the following error : Cannot read properties of null (reading 're')

Here is my minimum reproducible example:

## Works

:::mermaid
%%{init: {"flowchart": {"defaultRenderer": "dagre"}} }%%
flowchart TD
subgraph A
end
:::
## Does not work
:::mermaid
%%{init: {"flowchart": {"defaultRenderer": "elk"}} }%%
flowchart TD
subgraph B
end
:::

Here's a screenshot : image

Please note that I am aware that this may be an issue with mermaid itself. Running the code in 1.21.0 or 1.20.0 yields instead Cannot read properties of null (reading 'he'), and I think I had it work once on a graph I can't find in 1.21.0 where it didn't in 1.22.0, but I since deleted it as it was too complex for a minimum viable exemple (😓)

mjbvz commented 3 months ago

Seems like the same error happens in the mermaid live editor

Please file this against Mermaid JS directly so they can take a look