Edit Mermaid diagrams visually in VS Code

Drag, connect and restyle a Mermaid diagram on Flowgraph's canvas inside VS Code, and every change is written back into the .mmd file or Markdown block as ordinary code.

API and integrations · Updated December 4, 2026 · 4 min read

The Flowgraph Studio extension can open a diagram on the same canvas the website uses, inside VS Code. You drag nodes, connect them and pick a theme there, and the extension writes each change into your file as an ordinary edit. There's no second copy anywhere: the file in your repository is the diagram, so VS Code's Undo, Save, the unsaved dot and git all work as they do when you type.

Plan: Free, Pro and Pro Max. The visual editor is free. Signed in on Pro or Pro Max, the Pro icon sets (such as the Gen AI icons) draw in it and are unlocked in its icon picker.

Open the visual editor

For a .mmd or .mermaid file, use any of these:

  • Edit Visually in the editor's title bar (the layout icon).
  • Edit Visually in the line of links at the top of the file.
  • Flowgraph: Edit Visually from the command palette.

It opens beside the text editor, so you see the code and the canvas together. Typing in the text editor redraws the canvas, and changes on the canvas appear in the text straight away.

A Mermaid file in VS Code on the left, and Flowgraph's visual editor on the right with the Orders API node selected and moved; the file's last line now holds the saved positions

To always open .mmd files on the canvas, right-click one in the Explorer, choose Open With…, then Configure default editor for '*.mmd'… and pick Flowgraph Visual Editor. The text editor is the default until you do.

What you can do on the canvas

  • Move and resize: drag a node, or drag the handles of a selected one. Drag on empty canvas to select several.
  • Connect: select a node and drag one of its + handles onto another node. Click a + instead to add a new node connected on that side.
  • Add: Node, Icon node (the icon picker, with the cloud, brand and Lucide sets), and Text in the toolbar.
  • Change a node: select it and edit its label, subtitle, status and shape in the bar above the canvas.
  • Auto layout: clear the saved positions and let Flowgraph lay the diagram out again.
  • Style: the panel on the right has the website's themes, colours, fonts and layout settings.

Delete removes the selection; Escape clears it.

How changes reach the file

Everything you do becomes normal Mermaid code in the file:

  • Positions go into a %% flowgraph-layout: comment line at the end, the same line the website writes. The first drag adds it; later ones update it.
  • A style you pick goes into a %% flowgraph-theme: line just above it. If your repository's flowgraph.yml already gives the file that style, no line is added. See Keep a diagram's style in its code.
  • New nodes and connections are written as Mermaid statements.

The visual editor after choosing Forest Canopy: the canvas is drawn in Forest Canopy, and the file has a flowgraph-theme line above its layout line

Because each change is an edit of the file:

  • Undo (Ctrl+Z, Cmd+Z on a Mac) takes back the last change, from either side.
  • Save works as usual, and the tab shows the unsaved dot until you do.
  • Git shows only the lines that changed. A drag changes the layout line; a new theme changes the theme line.
  • Opening a file on the canvas doesn't change it. Flowgraph fixes each node's position in the code with your first change, not before.

Other Mermaid tools ignore %% comment lines, so the file still draws everywhere else, in their own layout and style.

Edit a diagram inside a Markdown file

Each ```mermaid block in a Markdown file has Edit Visually in the line of links above it. The canvas opens on that block alone, beside the file. Changes replace only the block's lines, indented like its fence, and the rest of the file is never touched.

A README in VS Code with a Mermaid block of rich nodes, and the visual editor beside it on that block; a node was dragged, and the block now ends with its layout line

If you change the block in the text while the canvas is open, the canvas redraws from your text.

What stays on the website

Some things need your Flowgraph Studio account and are on flowgraph.studio only: comments and reviews, version history (git does that job for files), share links, your saved presets and snippets, and AI help. Use Open on flowgraph.studio in the line of links when you need them.

More guides