DEV Community

drevispas
drevispas

Posted on • Updated on

Mermaid snippet

Mermaid is a diagram creation tool built in the Github. You can create a diagram by typing '''mermaid''' on a markdown file (You have to replace quotes with back quotes actually).
Here a sequence diagram snippet being referred as a sample.

'''mermaid
sequenceDiagram
    %% Participants
    participant A as Alice
    participant B as Bob
    link A: Go to Wiki @ https://en.wikipedia.org/wiki/Alice

    %% Main loop
    autonumber %% Turn on sequence numbers on arrows
    loop Every minute
        opt A is ready
            A->>+B: OK?
        end
        note left of A: Note for Alice
        note right of B: Note for Bob
        alt B is ready
            B-->>A: Yes
        else B is not ready
            B-->>-A: No
        end
        note over A,B: Note for both
    end
'''
Enter fullscreen mode Exit fullscreen mode

To render the sequence diagram you wrote at Intellij, enable "mermaid" markdown extension:

Image description

Top comments (0)