这是indexloc提供的服务,不要输入任何密码
Skip to content

Empty message in mermaid sequence diagram not working #1823

@ls-bit

Description

@ls-bit

Mermaid allows sequence diagrams to contain empty messages. For an empty message just a whitespace is added instead of text. It should render a line without text. GitHub handles this correctly:

sequenceDiagram
    Alice->>John: Hello
    John-->>Alice: 
Loading

Kroki throws an error for the same diagram:

Error 400: Error: Syntax error in graph: Parse error on line 5: ...! John-->>-Alice: ----------------------^ Expecting 'NEWLINE', 'AS', ',', 'SOLID_OPEN_ARROW', 'DOTTED_OPEN_ARROW', 'SOLID_ARROW', 'BIDIRECTIONAL_SOLID_ARROW', 'DOTTED_ARROW', 'BIDIRECTIONAL_DOTTED_ARROW', 'SOLID_CROSS', 'DOTTED_CROSS', 'SOLID_POINT', 'DOTTED_POINT', 'TXT', got 'INVALID' Error: Parse error on line 5: ...! John-->>-Alice: ----------------------^ Expecting 'NEWLINE', 'AS', ',', 'SOLID_OPEN_ARROW', 'DOTTED_OPEN_ARROW', 'SOLID_ARROW', 'BIDIRECTIONAL_SOLID_ARROW', 'DOTTED_ARROW', 'BIDIRECTIONAL_DOTTED_ARROW', 'SOLID_CROSS', 'DOTTED_CROSS', 'SOLID_POINT', 'DOTTED_POINT', 'TXT', got 'INVALID' at Ot.parseError (file:///usr/local/kroki/assets/mermaid/chunks/mermaid.esm.min/sequenceDiagram-7SUASMRF.mjs:1:14208) at Ot.parse (file:///usr/local/kroki/assets/mermaid/chunks/mermaid.esm.min/sequenceDiagram-7SUASMRF.mjs:3:174) at Diagram.fromText (file:///usr/local/kroki/assets/mermaid/mermaid.esm.min.mjs:3:253) at async Object.render (file:///usr/local/kroki/assets/mermaid/mermaid.esm.min.mjs:10:1164)

https://kroki.io/mermaid/svg/eNorTi0sTc1LTnXJTEwvSszlUgACx5zM5FRdOzuv_Iw8KwWP1JycfLA4iK8LFAfLWykAAEB5EiQ=

If the empty message is not the last line it also works in Kroki:

sequenceDiagram
    Alice->>John: Hello
    John-->>Alice: 
    John->>Alice: Hello
Loading

https://kroki.io/mermaid/svg/eNorTi0sTc1LTnXJTEwvSszlUgACx5zM5FRdOzuv_Iw8KwWP1JycfLA4iK8LFAfLWylgE0sBAPLhF68=

Maybe this happens due to input being trimmed somewhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions