Mermaid: Class diagram parser breaks depending on length of content between brackets

Created on 31 Oct 2019  路  9Comments  路  Source: mermaid-js/mermaid

Describe the bug
Here's a sample. Just add or remove letters from the content between brackets.

https://mermaidjs.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoiY2xhc3NEaWFncmFtXG5jbGFzcyBGb297XG4gIGJhcigpOmxpc3Q8Q0hBTkdFVEhJUz5cbn0iLCJtZXJtYWlkIjp7InRoZW1lIjoiZGVmYXVsdCJ9fQ

To Reproduce
Steps to reproduce the behavior:

  1. Open sample above.
  2. Add or remove letters from the content between brackets

Expected behavior
No exception.

Class Retained Approved Bug / Error

All 9 comments

Can't reproduce in the live editor with 8.4.0. Which mermaid version did you use?

Using the exact class above didn't work for me when pasted in the live editor with 8.4.0, but changing the length of the text between the angle brackets can make it work. It seems stateful, but it will be something like odd length words work and even length don't (or the opposite).

Yeah, there's something weird. The length of the word between <> breaks or not the parser.
Here's a sample. Just add or remove letters from the content between brackets.

https://mermaidjs.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoiY2xhc3NEaWFncmFtXG5jbGFzcyBGb297XG4gIGJhcigpOmxpc3Q8Q0hBTkdFVEhJUz5cbn0iLCJtZXJtYWlkIjp7InRoZW1lIjoiZGVmYXVsdCJ9fQ

Edited the title and opening post so it's clear for whoever wants to pick the issue up.

Right, that must be a flaw in the parser definition I added. Gonna grab this one.

It's interesting that this does not only happen inside the < > brackets but also for the member or the class name.

@chris579 You're right. Also, note that this only occurrs when there is an annotation that uses <>

Yep, there's a connection between that. This does also happen when using two brackets. Strange stuff going around.

Tried to reproduce this on latest development and failed to do so. I modified the length of the annotation string, added whitespaces to the class and the member names. Can someone reproduce this?

It cannot be reproduced on latest version.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SteveEdson picture SteveEdson  路  16Comments

chetanvsharma picture chetanvsharma  路  17Comments

imrefazekas picture imrefazekas  路  15Comments

stckcrsh picture stckcrsh  路  15Comments

karthikdav picture karthikdav  路  29Comments