mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
https://mermaid.js.org
MIT License
71.18k stars 6.41k forks source link

.-> dotted arrows cause syntax error in newest Mermaid release #5381

Open tomjn opened 6 months ago

tomjn commented 6 months ago

Description

Recently our github mermaid diagrams broke, and they started failing in the mermaid live tester.

I tracked this down to .->, removing dotted lines fixed the issue.

Steps to reproduce

This diagram generates syntax errors:

flowchart TD
    start[First]--"label"-->second[Second]
    second.->third[[Third]]
    second.->fourth(Fourth)

The same diagram using --> instead of .-> does not:

flowchart TD
    start[First]--"label"-->second[Second]
    second-->third[[Third]]
    second-->fourth(Fourth)

Screenshots

Screenshot 2024-03-13 at 14 47 15

Code Sample

flowchart TD
    start[First]--"label"-->second[Second]
    second.->third[[Third]]
    second.->fourth(Fourth)

Setup

Suggested Solutions

No response

Additional Context

No response

tomjn commented 6 months ago

The test case can be simplified further:

flowchart TD
    one.->two
tomjn commented 6 months ago

Further investigation reveals that this works:

flowchart TD
    one .-> two

But this does not:

flowchart TD
    one.-> two

Previously it worked

sidharthv96 commented 6 months ago

Thanks for the detailed report @tomjn! Github's version jump was very broad, 10.0.2 to 10.8.0, more than a year's work. Although we keep backwards compatibility in the syntax as a very important criteria (even in major version changes), some things get through unintentionally.

We'll try to investigate what the issue was, but .-> working had not been intentional, as the documentation mentions -.-> as a dotted arrow.