Edit Mermaid diagrams visually, inside VS Code

The Flowgraph Studio extension now opens diagrams on the website's canvas inside VS Code. Drag, connect and restyle, and every change lands in your file as plain code.

News · · 2 min read

Mermaid's promise is that a diagram is just code, so it lives next to what it describes and changes in the same pull request. The catch has always been layout. Text is a poor way to say "put the queue under the API, not beside it", so most people either accept whatever the layout engine decides or leave the editor for a drawing tool, and the code and the picture drift apart.

The Flowgraph Studio extension for VS Code now has a visual editor. Open a .mmd file, choose Edit Visually, and the same canvas you use on flowgraph.studio opens beside your code. Drag a node, connect two others, pick a theme: each change is written back into the file as you make it.

Flowgraph's visual editor in VS Code beside a Mermaid file, with the diagram restyled in Forest Canopy; the file now ends with a theme line and a layout line
Restyled on the canvas: the file gains one theme line and keeps its positions in the layout line below it.

The file is the only copy

There's no project to sync and nothing stored anywhere else. The canvas reads your file and sends each change back as an ordinary edit, so everything VS Code does with text still works:

  • Undo takes back a drag or a restyle, whether your cursor is in the code or on the canvas.
  • The unsaved dot and Save behave as they do for typing.
  • Git shows small diffs. Positions live in one %% flowgraph-layout: comment line and the style in one %% flowgraph-theme: line, so moving a node changes one line, and so does a new theme.
  • Typing in the code redraws the canvas, so you can write the structure in text and arrange it by hand.

Other Mermaid tools skip those comment lines, so GitHub, GitLab and docs sites keep drawing the diagram as before.

Diagrams in your README too

A Mermaid block in a Markdown file has Edit Visually in the line of links above it. The canvas opens on that block alone, and only the block's lines change. The paragraphs around it, and any other diagrams in the file, are left exactly as they were.

What's in it

The canvas is the website's own: rich nodes with cloud and brand icons, Manual mode's drag and resize, connecting nodes, adding nodes and icon nodes, Auto layout, and the Style panel with every theme, colour and font. Signed in on a plan that includes them, the Pro icon sets, such as the Gen AI icons, draw on the canvas and are unlocked in its icon picker.

Some things stay on flowgraph.studio because they belong to your account: comments, version history, share links, saved presets and snippets, and AI help. Open on flowgraph.studio is one click away when you need them.

Try it

Install or update the extension, open any .mmd file and choose Edit Visually in the title bar. The guide Edit Mermaid diagrams visually in VS Code covers the details, and Keep a diagram's style in its code explains the theme line.

More from the blog

Follow the blog by RSS