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
72.62k stars 6.62k forks source link

Class Diagram Issues when using Mermaid in Stackedit #748

Closed monsterkrampe closed 5 years ago

monsterkrampe commented 6 years ago

I was currently trying out https://stackedit.io/ and wanted to create some class diagrams using mermaid, which could look like this:

```mermaid
classDiagram
Class01 <|-- AveryLongClass : Cool
Class03 *-- Class04
Class05 o-- Class06
Class07 .. Class08
Class09 --> C2 : Where am i?
Class09 --* C3
Class09 --|> Class07
Class07 : equals()
Class07 : Object[] elementData
Class01 : size()
Class01 : int chimp
Class01 : int gorilla
Class08 <--> C2: Cool label
```

The first issue is, that the grammar of the class Diagram does currently not allow a line break at the end of the statements, so the above code block will not work.

The next thing I noticed after working around the first problem was, that the diagram was only rendered the first time. Each time after that cannot read property x of undefined occurred.

Another thing I wanted to try was to add a Class without a relation as described in #609.

In summary there are the following tasks:

Note that these issues can be easily reproduced in the Live Editor

I started working at those and I am about to submit a Pull Request.

bendem commented 5 years ago

This, I'm unsure how to go about using mermaidjs to draw class diagrams since you can't write a markdown code block that doesn't end with a new line. Was there any work on this?

monsterkrampe commented 5 years ago

Hi @bendem. There was some work on this and I already submitted a PR quite some time ago as you can see. This should fix the 3 problems mentioned here, but sadly no one merged or even reviewed it. Maybe it's because not all the checks passed but the only one failing is code climate as it marks export statements from different files as duplicates, which have nothing to do with each other.

I did not receive any human feedback on this until now, so I don't know if this will ever be merged.

monsterkrampe commented 5 years ago

My PR got merged :tada:
This Issue should be fixed.

Fell free to leave feedback if something still does not work for you for some reason.