Reverse arrows <-- not supported in flowchart
Description
Using a reverse arrow (<--) in a Mermaid flowchart diagram leads to a cryptic syntax error. Many users may naturally assume B <-- C is valid, expecting it to behave like C --> B, especially since reverse arrows are supported in other graphing tools.
Instead of a helpful explanation, Mermaid throws the following error:
Expecting 'LINK', 'UNICODE_TEXT', 'EDGE_TEXT', got '1'
This behavior is confusing and not well-documented. Either the syntax should be supported, or Mermaid should provide a more descriptive error message.
Steps to reproduce
- Go to https://mermaid.live/
- Paste the following code in the editor:
flowchart TD
A --> B
B <-- C
- Notice the syntax error thrown:
Expecting 'LINK', 'UNICODE_TEXT', 'EDGE_TEXT', got '1'
Screenshots
Code Sample
Setup
- Mermaid Version: v11.5.0 (tested on Mermaid Live Editor)
- Browser: Chrome v122
- Platform: Windows 11
Suggested Solutions
Add support for B <-- C syntax and internally convert it to C --> B.
Improve error messaging for unsupported arrow syntax. Instead of a cryptic parser error, show:
"Reverse arrows (<--) are not currently supported. Try writing C --> B instead."
Additional Context
No response
Source: mermaid-js/mermaid