Skip to content

Instantly share code, notes, and snippets.

@romyilano
Last active January 16, 2024 23:44
Show Gist options
  • Save romyilano/3a94879b1b55de7dd5997453df4efeb1 to your computer and use it in GitHub Desktop.
Save romyilano/3a94879b1b55de7dd5997453df4efeb1 to your computer and use it in GitHub Desktop.
Drawing mermaid state machine diagrams

Add a space in a state name

stateDiagram
    classDef yourState font-style:italic,font-weight:bold,fill:white

    yswsii: Your state with spaces in it
    [*] --> yswsii:::yourState
    [*] --> SomeOtherState
    SomeOtherState --> YetAnotherState
    yswsii --> YetAnotherState
    YetAnotherState --> [*]

To show this inside the markdown

stateDiagram
    classDef yourState font-style:italic,font-weight:bold,fill:white

    yswsii: Your state with spaces in it
    [*] --> yswsii:::yourState
    [*] --> SomeOtherState
    SomeOtherState --> YetAnotherState
    yswsii --> YetAnotherState
    YetAnotherState --> [*]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment