Code and diagram

Show the code, the diagram or both, and how the code and the canvas stay in sync.

Every diagram has code beside it, and the two are always the same diagram. This page covers showing the code and how edits in one reach the other.

The code pane

The code pane sits to the left of the diagram. At first it takes about a third of the width. Drag the line between them to change it.

The pane is named after the kind's code:

KindCode paneSyntax
BPMN processFlowmarkFlowmark
Sequence diagramSequence codeSequence code
ER diagramSchema codeSchema code
FlowchartMermaidFlowchart code

Show the code, the diagram or both

The View switch at the top of the diagram has three choices:

  • the code only, such as Flowmark only,
  • Side by side,
  • Diagram only.

⌘ \ (Ctrl \ on Windows and Linux) hides the code, and shows it again beside the diagram.

In a window too narrow for both, you get one at a time. Side by side then says Too narrow for side by side.

From the canvas to the code

The diagram and the code are two ways of looking at one model. A canvas edit changes the model, and the app writes the code again from it.

The code follows changes made on the canvas or by the assistant. It waits while you're in the middle of typing.

From the code to the diagram

Changes you type apply to the diagram after a short pause.

  • When your typing reaches the diagram, the pane's header says In sync for a moment.
  • If a line has a mistake, the header shows the message and its line number instead. So does the Problems panel. Select the message to jump to that line.
  • The diagram keeps its last good state until you fix the mistake.

Reformat, in the pane's header, tidies the code into the app's standard layout. It shows only when the code isn't in that layout already.

The BPMN XML

For a process, the app also writes BPMN XML from the same model. To see it, choose View BPMN XML… in the Export menu. See Export.

The canvas always shows the app's own layout. When you import a file that has a layout of its own, its XML keeps that layout until your first change. After that, the XML follows the app's layout too.

On this page