DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
FREEDOM251

Freedom251 › Blog › Diagram syntax

How to Escape Reserved Keywords in Mermaid Flowcharts and State Diagrams

By Freedom251 Team · · 3 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a Mermaid flowchart, the documented reserved-word trap is the exact lowercase word end: change it to End or END. For other troublesome label characters, use a quoted label or entity codes. In a state diagram, keep the identifier simple and put the reader-facing wording in a separate description.

Fix lowercase end in a flowchart

Mermaid’s official flowchart documentation warns that lowercase end in a flowchart node breaks the diagram. Its documented fix is to capitalize the entire word or any of its letters—for example, End or END.

As an Amazon Associate I earn from qualifying purchases.

This applies to the exact lowercase spelling. If the visible label needs to read “end,” changing its capitalization is the documented option in the cited guidance. The documentation also mentions a workaround, but the available excerpt does not show its syntax, so it is safer not to guess at it.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Handle punctuation and quotes in flowchart labels

A node identifier and its displayed label are different parts of flowchart syntax. For example, id1[This is the text in the box] uses id1 as the identifier and the bracketed text as the visible label.

When label text contains characters that can interfere with parsing, quote the displayed text:

id1["This is the (text) in the box"]

Mermaid also documents entity codes for special characters. Its example uses #quot; to represent a double quote:

A["A double quote:#quot;"]

The flowchart documentation says decimal character values and HTML character names are supported as well. Quoting and entity codes address awkward label characters; they should not be confused with the special lowercase end rule.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Separate a state’s identifier from its displayed name

State diagrams let you use a stable, simple identifier for transitions while showing different wording to readers. The official state diagram documentation shows two forms:

state "This is a state description" as s2

s2 : This is a state description

In the first form, s2 is the identifier and the quoted string is the description. In the second, the colon attaches a description to the state identifier. Transitions use identifiers, such as s2 --> s3, so the visible wording can be descriptive without becoming the token used to connect states.

Choose the fix that matches the problem

Problem Diagram type Documented approach
The node label is exactly lowercase end Flowchart Capitalize the whole word or any letter, such as End or END.
Label text contains punctuation or quotes that affect parsing Flowchart Use a quoted label; use an entity code when needed.
The wording should differ from the token used to connect states State diagram Use a simple identifier and assign a separate quoted state description or colon description.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Check a diagram that still fails

  1. Identify the diagram type. Confirm whether the snippet is a flowchart or a state diagram; their syntax and documented guidance differ.
  2. Check the renderer and Mermaid version. Test in the same environment where the diagram will appear, since embedded renderers can use different versions.
  3. Apply the matching fix. For flowchart labels, check lowercase end first, then quote troublesome text or use entity codes. For state diagrams, separate the identifier from the description.
  4. Reduce the snippet if needed. Remove unrelated nodes and transitions until only the smallest failing example remains, then compare it in the target renderer.

The cited flowchart page identifies lowercase end as a specific trap; the cited state diagram page demonstrates separate identifiers and descriptions but does not provide a complete list of reserved words. Do not assume a word that causes trouble in one diagram type behaves the same way in the other.

Best Value
Colortivity The Little Mermaid Ariel Themed Coloring and Activity Book with Bonus Cutout Door Hanger on Back - 80 Pages
  • The Little Mermaid-themed Coloring and Activity Book
  • Book contains 80 fun-filled coloring and activity pages!
  • Book measures approx 7.75'' x 10.75''
  • Cover varies-- contents do not (see photos)
  • Perfect for quiet indoor play

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Diagram syntaxFlowchartsMermaidState diagramsTroubleshooting

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.