Skip to content

Mermaid stateDiagram-v2 with state description is not rendered

Summary

For markdown documents the mermaid stateDiagram-v2 is not rendered if the states contain state descriptions.
The same diagramms are rendered for example in VSCode or if a Static Website is generated based on the markdown documents.

Steps to reproduce

Working example based on basic stateDiagram

stateDiagram
    [*] --> Idle
    Idle --> Active : CONTINUE
    state Active {
        [*] --> Run
        Run--> Stop: CONTINUE
        Stop--> Run: CONTINUE

        Run: Run
        Run: entry/start
        Run: check

        Stop: Stop
        Stop: entry/stop
        Stop: check
    }

    Idle : Idle
    Idle : entry/reset
    Idle : check

Failing example based on stateDiagram-v2

stateDiagram-v2
    [*] --> Idle
    Idle --> Active : CONTINUE
    state Active {
        [*] --> Run
        Run--> Stop: CONTINUE
        Stop--> Run: CONTINUE

        Run: Run
        Run: entry/start
        Run: check

        Stop: Stop
        Stop: entry/stop
        Stop: check
    }

    Idle : Idle
    Idle : entry/reset
    Idle : check

Working example based on stateDiagram-v2

stateDiagram-v2
    [*] --> Idle
    Idle --> Active : CONTINUE
    state Active {
        [*] --> Run
        Run--> Stop: CONTINUE
        Stop--> Run: CONTINUE
    }

Example Project

This concerns only the display of mermaid diagramms on the Webpage

What is the current bug behavior?

mermaid stateDiagram-v2 are not rendered correctly if state descriptions are used.

What is the expected correct behavior?

mermaid stateDiagram-v2 are rendered like in other tools.

Relevant logs and/or screenshots

See Steps to reproduce

Output of checks

This bug happens on GitLab.com with mermaid version 8.9.0

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes