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

Sequence diagram example from docs says it is "not syntactically correct" #238

Closed darkvertex closed 3 months ago

darkvertex commented 5 months ago

This diagram below works in https://mermaid.live but not with the extension.

It is lifted from the docs: https://mermaid.js.org/syntax/sequenceDiagram.html#actor-creation-and-destruction-v10-3-0

(It is the create/destroy stuff that is breaking things. If I drop it, it renders. It is allegedly legal though!)

sequenceDiagram
    Alice->>Bob: Hello Bob, how are you ?
    Bob->>Alice: Fine, thank you. And you?
    create participant Carl
    Alice->>Carl: Hi Carl!
    create actor D as Donald
    Carl->>D: Hi!
    destroy Carl
    Alice-xCarl: We are too many
    destroy Bob
    Bob->>Alice: I agree

but the extensions says:

image

I am using the latest release version of the extension as of writing (v1.21.0) and this is my VSCode about info, if it helps:

Version: 1.85.2 (user setup)
Commit: 8b3775030ed1a69b13e4f4c628c612102e30a681
Date: 2024-01-18T06:40:10.514Z
Electron: 25.9.7
ElectronBuildId: 26354273
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.22621

Curiously, Github's own Mermaid rendering also struggles to render it if I put the "mermaid" indicator in the triple ticks: 🤔

sequenceDiagram
    Alice->>Bob: Hello Bob, how are you ?
    Bob->>Alice: Fine, thank you. And you?
    create participant Carl
    Alice->>Carl: Hi Carl!
    create actor D as Donald
    Carl->>D: Hi!
    destroy Carl
    Alice-xCarl: We are too many
    destroy Bob
    Bob->>Alice: I agree

If we drop the create/destroy bits, it renders in both GitHub and the extension:

sequenceDiagram
    Alice->>Bob: Hello Bob, how are you ?
    Bob->>Alice: Fine, thank you. And you?
    Alice->>Carl: Hi Carl!
    Carl->>D: Hi!
    Alice-xCarl: We are too many
    Bob->>Alice: I agree
mjbvz commented 5 months ago

Works fine for me

Image

Try disabling all other extension to see if one of them is causing issues

mjbvz commented 3 months ago

Closing as not reproducible