diff --git a/docs/syntax/stateDiagram.md b/docs/syntax/stateDiagram.md index f823689aa..807d6149a 100644 --- a/docs/syntax/stateDiagram.md +++ b/docs/syntax/stateDiagram.md @@ -501,15 +501,21 @@ There are two ways to apply a `classDef` style to a state: A `class` statement tells Mermaid to apply the named classDef to one or more classes. The form is: - class [one or more state names, separated by commas] [name of a style defined with classDef] +```txt + class [one or more state names, separated by commas] [name of a style defined with classDef] +``` Here is an example applying the `badBadEvent` style to a state named `Crash`: - class Crash badBadEvent +```txt +class Crash badBadEvent +``` Here is an example applying the `movement` style to the two states `Moving` and `Crash`: - class Moving, Crash movement +```txt +class Moving, Crash movement +``` Here is a diagram that shows the examples in use. Note that the `Crash` state has two classDef styles applied: `movement` and `badBadEvent` @@ -566,7 +572,9 @@ and `badBadEvent` You can apply a classDef style to a state using the `:::` (three colons) operator. The syntax is - [state]:::[style name] +```txt +[state]:::[style name] +``` You can use this in a diagram within a statement using a class. This includes the start and end states. For example: diff --git a/packages/mermaid/src/docs/syntax/stateDiagram.md b/packages/mermaid/src/docs/syntax/stateDiagram.md index ad2b62f8e..ddfe61c49 100644 --- a/packages/mermaid/src/docs/syntax/stateDiagram.md +++ b/packages/mermaid/src/docs/syntax/stateDiagram.md @@ -318,19 +318,19 @@ There are two ways to apply a `classDef` style to a state: A `class` statement tells Mermaid to apply the named classDef to one or more classes. The form is: -``` +```txt class [one or more state names, separated by commas] [name of a style defined with classDef] ``` Here is an example applying the `badBadEvent` style to a state named `Crash`: -``` +```txt class Crash badBadEvent ``` Here is an example applying the `movement` style to the two states `Moving` and `Crash`: -``` +```txt class Moving, Crash movement ``` @@ -365,7 +365,7 @@ and `badBadEvent` You can apply a classDef style to a state using the `:::` (three colons) operator. The syntax is -``` +```txt [state]:::[style name] ```