Preview Flowgraph diagrams in VS Code, with icons, layout and your theme

Install the Flowgraph Studio extension to preview Mermaid files and Markdown blocks in VS Code as Flowgraph draws them, see mistakes in plain words, and export SVG or PNG.

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

A diagram you arranged in Flowgraph Studio and saved into your repository looks different in most editors. VS Code's Markdown preview doesn't know the icons, the rich node cards, the positions you set by hand or your theme, so it draws a plainer, rearranged version. The Flowgraph Studio extension draws it the way the website does, beside your code, as you type.

Plan: Free, Pro and Pro Max. The extension is free and needs no account.

Install it

In VS Code, open Extensions (Ctrl+Shift+X, or Cmd+Shift+X on a Mac), search for Flowgraph Studio and choose Install. You can also install it from its Marketplace page. Editors that install from Open VSX can get it from its Open VSX page.

It needs VS Code 1.90 or later, and it's free. It draws everything on your computer and sends nothing anywhere, unless you choose Open on flowgraph.studio (below).

Preview a Mermaid file

Open a .mmd or .mermaid file and click Open Preview to the Side in the editor's title bar, or press Ctrl+K V (Cmd+K V). The preview redraws as you type, before you save.

A Mermaid file in VS Code beside the Flowgraph preview, which draws it with icons in the Midnight theme

  • Move around: drag the diagram. Hold Ctrl (Cmd) and scroll to zoom, or use −, +, Fit and 100% at the top right.
  • Layout: a diagram you arranged on the website keeps its positions. They travel in the diagram's code as a %% flowgraph-layout: comment, so commit the code the website gives you and the preview draws it as you left it.
  • Rich nodes and icons: @icon: cards, subtitles and badges draw as they do on the website. See Rich nodes and icons.

Diagrams in Markdown

In a Markdown file, each ```mermaid block has two links above it: Preview in Flowgraph opens it in the preview, which then follows your cursor from block to block, and Open on flowgraph.studio opens it on the website.

VS Code's own Markdown preview (Ctrl+Shift+V in a Markdown file) draws the blocks with Flowgraph too, so a README reads the way it will in your docs.

VS Code's Markdown preview showing a README with its Mermaid diagram drawn by Flowgraph

To leave Markdown blocks to VS Code or another extension, turn off the setting Flowgraph: Markdown Preview. To hide the links above the blocks, turn off Flowgraph › Markdown: Code Lens.

Mistakes in plain words

When the code has a mistake, the preview keeps the last good drawing, faded, and explains the mistake at the bottom, in the same words the website uses. It's also listed in the Problems panel, on the line where it is.

An unfinished arrow in a Mermaid file: the preview explains it, and the Problems panel lists it on its line

Use your repository's theme

The preview uses the same style as the images your CI makes, looked up in this order:

  1. If the diagram has its own %% flowgraph-theme: line, that style. See Keep a diagram's style in its code.
  2. If the repository has a flowgraph.yml with a theme: file (see Keep README diagrams up to date in CI), that theme.
  3. Otherwise the Flowgraph: Theme setting: a preset's name, such as Midnight or Blueprint CAD, or a theme file exported from Flowgraph Studio with Export → Theme JSON.
  4. Otherwise Glass, Flowgraph's default.

Change the theme file and open previews redraw. In a folder you haven't trusted, the folder's own theme setting is ignored, so a repository you've just cloned can't point it at files elsewhere on your computer.

Edit diagrams visually

Choose Edit Visually in the title bar of a .mmd file, or above a Markdown block, and Flowgraph's canvas opens beside the code. Drag, connect and restyle there; each change is written into the file as an ordinary edit, so Undo, Save and git work as usual. Edit Mermaid diagrams visually in VS Code covers it in full.

Export an image

Click Export… in the preview, or run Flowgraph: Export Diagram… from the command palette. Choose PNG at 1×, 2× or 3× (with the theme's background or transparent), or SVG with its fonts embedded, then where to save it. The images are made the same way as on the website. Signed out, they carry the small Flowgraph Studio watermark that signed-out exports carry; signed in, your plan's watermark-free exports apply (below).

Sign in for your plan

Previews, export and the rest work without an account. Signing in brings your plan into VS Code:

  • Pro icons: on Pro and Pro Max, Gen AI icons (@icon:genai:…) draw in previews and in VS Code's Markdown preview.
  • Exports: Free's 10 watermark-free exports a month apply, shared with the website (each version of a diagram counts once); Pro has no limit.

Open the Flowgraph Studio view in the activity bar and choose Sign In, or use Sign in with Flowgraph Studio in VS Code's Accounts menu. Your browser opens a Flowgraph Studio page asking you to connect the editor; choose Connect, and you're sent back to VS Code. The view then shows your plan and what's left this month.

The connection is an API key named after your editor, such as "Visual Studio Code (connected app)". VS Code keeps it in your system's keychain, and it's listed in Account settings → Render API, where you can revoke it like any key (see Connect by signing in). Sign Out in the view revokes it for you. Your diagrams stay on your computer: the extension reads your plan, fetches the Pro icons, and counts exports by a fingerprint of the image, not the diagram.

If the browser can't send you back to the editor, as in some remote setups, run Flowgraph: Sign In with API Key from the command palette and paste a key from Account settings → Render API.

Keep a file and a saved diagram in step (Pro)

On Pro and Pro Max, the Saved Diagrams section of the Flowgraph Studio view lists the diagrams in your account, by project. Click one to open it with its preview, in its own style, or choose Save into Workspace… to make it a .mmd file in your repository, linked to the saved diagram.

To link a file you already have, open it and click Save to Flowgraph Studio in the line of links at the top of the file (or choose it from the editor's … menu, or right-click the file in the Explorer). It's saved to your account, in your repository's theme, and linked. From then on, the line at the top of the file offers Push, Pull and Open on flowgraph.studio, which opens the saved diagram itself:

  • Push sends the file's changes to the saved diagram.
  • Pull brings changes made on the website into the file. Arrange the diagram on the canvas, pull, and the new positions are in the file's code.
  • If the file and the saved diagram both changed since the last push or pull, VS Code asks: Compare them side by side, Keep Mine (the file's code replaces the site's, and the site's version is kept in its version history first), or Take Theirs (the site's code replaces the file's; Undo or your version control brings the file's back).

Saved diagrams belong to one account (projects can't be shared yet), so VS Code keeps the links for you, in this workspace, rather than in the repository. A teammate who wants the same file in their account saves their own copy. A linked file shows Flowgraph in the status bar; click it for the same actions.

Draw diagrams from your code

Right-click a folder or a source file in the Explorer and choose Draw Code Diagram…, or run it from the command palette. Pick a codebase map, module dependencies, a route map, a class diagram, a call map, or a function's flowchart: for a flowchart, the function your cursor is in is offered first.

The diagrams are drawn on your computer by the same code as the website's diagrams from a repository and flowgraph-cli, so they match; nothing is sent anywhere and no account is needed. TypeScript, JavaScript, Python, Java, Go and C# are read. The result opens as Markdown, with notes on anything left out and the first diagram in the preview. Save it beside your code, or use Open on flowgraph.studio above a diagram to arrange it on the canvas.

Keep README diagrams up to date from VS Code

If the repository has a flowgraph.yml (see Keep README diagrams up to date in CI), run Flowgraph: Sync Diagrams to do what CI does: draw each diagram it lists, render the images that changed, and fill in the README's blocks. The changes appear in Source Control, ready to review and commit. Flowgraph: Check Diagrams Are Up to Date changes nothing and says whether anything is out of date.

Rendering images uses the API renders of the account you're signed in with (or a FLOWGRAPH_API_KEY in VS Code's environment); diagrams written as Mermaid need no account. Code diagrams and sync read the folder's files, and sync writes them, so they run only once you trust the folder.

Open it on flowgraph.studio

To arrange a diagram by hand, restyle it or share it, choose Open on flowgraph.studio: in the preview's title bar, from a Mermaid file's menu, from the command palette, or above a Markdown block. The website opens and asks before adding it as a new diagram, with its name and theme. Signed in, it's saved to your account like any other diagram.

The diagram travels in the link itself, after the #, which browsers don't send to the server. A very long diagram doesn't fit in a link, so its link is copied instead: press Ctrl+V (Cmd+V) on the page that opens.

When you're done on the website, copy its code back into the file. The positions come with it, so the preview in VS Code shows your new layout. See Edit Mermaid on the canvas for what you can change there.

More guides