mermaid/docs/n00b-syntaxReference.md
2021-05-02 01:20:26 -07:00

3.2 KiB

Diagram Syntax

Syntax is the next part of Mermaid. Syntax, together with Deployment and Configuration constitute the whole of Mermaid.

Mermaid's Syntax is not too tricky and there are thorough guides for each type of Diagram. However, it requires some precision to render them correctly. The Getting Started section can also provide some practical examples of mermaid syntax. The next section will also

Mermaid's syntax is used mainly to create and modify diagrams. to save diagrams, there are a couple of ways,we recommend saving the diagram's definition along with the diagram itself, to make the diagram easy to edit.

Diagram Breaking

One should beware the use of some words or symbols that can break diagrams, and using avoid them. Often these words or symbols only affect specific types of

%%{ }%% These are

Diagram Breakers Reason Solution
Comments
%%{``}%% Similar to Directives confuses the renderer. To comment, just use %%
Similar to Directives confuses the renderer.
Flow-Charts
'end' The word "End" can cause Flowcharts and Sequence diagrams to break wrap them in quotation marks to prevent breakage
Nodes inside Nodes Mermaid gets confused with nested shapes wrap them in quotation marks to prevent breaking graph LR

Mermaid Live Editor

Now, that you've seen what you should not add to your diagrams, you can play around with them in the Mermaid Live Editor.

Configuration

Configuration is the third part of Mermaid, after deployment and syntax. It deals with the different ways that Mermaid can be customized across different deployments.

If you are interested in altering and customizing your Mermaid Diagrams, you will find the methods and values available for Configuration here. It includes themes This section will introduce the different methods of configuring of the behaviors and apperances of Mermaid Diagrams. The Following are the most commonly used methods, and are all tied to Mermaid Deployment methods.

Configuration Section in the Live Editor.

Here you can edit certain values to change the behavior and appearance of the diagram.

The initialize() call, for when Mermaid is called via an API, or through a