joplin-plugin-enhancement icon indicating copy to clipboard operation
joplin-plugin-enhancement copied to clipboard

Parse error in Mermaid sequence diagrams

Open Pyroseza opened this issue 7 months ago • 2 comments

It seems like this plugin is unable to parse newer keywords for Mermaid sequence diagrams, here's an example:

Could not render Graph:

Parse error on line 2:
... Purple Alice & John participant A
-----------------------^
Expecting 'SOLID_OPEN_ARROW', 'DOTTED_OPEN_ARROW', 'SOLID_ARROW', 'DOTTED_ARROW', 'SOLID_CROSS', 'DOTTED_CROSS', 'SOLID_POINT', 'DOTTED_POINT', got 'NEWLINE'

and as a screenshot:

image

and now here's the sample diagram text to replicate with:

    sequenceDiagram
    box Purple Alice & John
    participant A
    participant J
    end
    box Another Group
    participant B
    participant C
    end
    A->>J: Hello John, how are you?
    J->>A: Great!
    A->>B: Hello Bob, how is Charly?
    B->>C: Hello Charly, how are you?

and as you can see in Github it is correct and renders fine:

    sequenceDiagram
    box Purple Alice & John
    participant A
    participant J
    end
    box Another Group
    participant B
    participant C
    end
    A->>J: Hello John, how are you?
    J->>A: Great!
    A->>B: Hello Bob, how is Charly?
    B->>C: Hello Charly, how are you?

This example comes directly from the Mermaid docs: https://mermaid.js.org/syntax/sequenceDiagram.html

Upon closer inspection several of the reserved keywords are not able to parse, perhaps it would be best to do a run through all the updated documentation and check all newer keywords.

Pyroseza avatar Nov 23 '23 09:11 Pyroseza