DRAKON Flowcharts
View and edit DRAKON flowcharts right in VS Code. Open a .drakon file (the DrakonHub format) and it
shows up as a diagram that you edit the way you do in DrakonHub: every change goes straight into the
JSON file, and edits of the JSON text redraw the diagram as you type.
Описание на русском

Why DRAKON
DRAKON is a visual language for algorithms. It was developed in the Soviet space programme (Buran)
to make algorithms clear to engineers, not only to programmers. DRAKON keeps the boxes of a
flowchart but adds strict layout rules, so every diagram is read the same way:
- Lines never cross.
- Branches instead of arrows that jump. A long algorithm is split into named branches (columns)
read left to right. A branch ends with an address: the name of the branch to go to next.
- A retry is just an address. In the ATM example below, a wrong PIN leads to the address "PIN"
at the bottom of the column. A classic flowchart draws the same retry as an arrow going back up
across the diagram, and every new retry adds one more such arrow.
- The main path goes straight down. "Yes" continues down and exceptions turn right, so the
normal course of events forms one vertical line.

Open samples/en/atm-withdrawal.drakon from the repository to see it for yourself: six branches,
three ways back to an earlier step and not a single crossing.
Features
.drakon files open as a diagram by default, ready for editing (see Editing). Click
the link mark of an action to open the link.
The diagram follows the file: edits in the text editor, git checkout and changes on disk redraw
it immediately.
Four color themes, chosen on the diagram toolbar or with the drakonFlowcharts.colorTheme setting:
- By meaning (default): icons are colored by their role in the algorithm, in a light or a dark
variant to match VS Code;
- VS Code colors: a single-color diagram in the colors of your VS Code theme, including high
contrast themes;
- Black and white: black on white, as on paper;
- Classic: the default DrakonWidget colors.
Tooltips: the diagram description over the title, and your own notes over any icon (see below).
Drag the diagram with the left mouse button, scroll with the wheel (Shift + wheel scrolls
horizontally), zoom with the −, 100%, + buttons or Ctrl + wheel.
The { } button and the DRAKON: Open as Text command open the file as JSON text; the editor
title button or DRAKON: Open as Flowchart switches back. Put both side by side to edit the text
and watch the diagram:

English and Russian interface, following the VS Code display language.
Editing
- Insert an icon: pick it on the palette on the left, or press
A (action), Q (question),
S (choice), C (case), L (loop) or B (branch), then click one of the yellow insertion points.
Esc hides the insertion points. Keys work in any keyboard layout.
- Edit text: double-click an icon, or select it and press
Enter. Right-click opens the menu:
text, upper text, link, format, delete, and two items of this extension: Tooltip… (the hint
field) and, on the title, Flowchart description….
- Select: click an icon;
Shift + drag draws a selection frame; the arrow keys move the
selection to the neighboring icon.
- Copy and move icons: copy (
Ctrl+C) or cut (Ctrl+X), paste (Ctrl+V) and click an
insertion point. Copied icons can be pasted into another diagram open in VS Code.
- Delete:
Delete or Backspace.
- Format: fill, border and text colors, border width and text alignment of icons; background,
lines and default icon colors of the whole diagram (right-click empty space, Flowchart format).
- Silhouette: the silhouette button on the palette turns a primitive into a silhouette and back.
- Undo and redo belong to VS Code (
Ctrl+Z, Ctrl+Y, the palette buttons) and are shared with
the text editor; Ctrl+S saves the file.
Every change is written to the .drakon file at once and touches only its own lines: the rest of the
file keeps its key order and indentation, so git diff stays short. Formatted text from DrakonHub
(bold, lists) is edited as HTML, plain paragraphs as plain text. A file from a read-only source, such
as a version from git history, opens for viewing only.
The "By meaning" theme
The shape of an icon already tells its type. The color repeats it, so the places where the algorithm
branches, repeats, waits or calls another diagram stand out across the whole diagram.
| Icons |
Color |
Meaning |
| title, end, branch, address |
gray-blue |
skeleton: start, end, branch boundaries |
| action, parameters |
no fill |
the bulk of the diagram; everything else stands out against it |
| question, choice, case |
yellow |
the algorithm branches |
| loop start and end |
violet |
repetition |
| insertion |
green |
a call to another diagram |
| shelf, input, output |
blue |
exchange with other participants |
| timer, pause, duration, process |
pink |
time and parallel processes |
| comment |
pale gray, muted text |
an explanation, not a step |
The palette has no red–green pair, so the colors stay distinguishable with color vision
deficiencies. Text contrast is at least 7:1 (WCAG AAA), muted comment text at least 4.5:1. The
picture at the top of this page shows every group of the table in the dark variant.
Hover over the title to see the diagram's description. Hover over any other icon to see its hint,
a field this extension adds to the format:
"a1": {
"type": "action",
"content": "Take the card",
"hint": "The card reader pulls the card in and reads the chip.",
"one": "q1"
}
Keep the icon text short and put the details into hint; edit it with Tooltip… in the icon's
menu. DrakonWidget and DrakonHub do not show this field, but DrakonHub keeps it when you import the
file and edit the icon there.
A .drakon file is JSON: the diagram name, optional params and description, and the items
object with icons by id. There are no coordinates: the layout is computed by
DrakonWidget, so a change of one icon is a change of
a few lines in git diff. Files exported from DrakonHub open as they are.
DrakonHub stores icon text written in its editor as HTML (<p>…</p>, bold, italic, lists), and the
extension shows it formatted. HTML from a file is cleaned up before display: only text formatting
tags are kept, without attributes, so a file cannot run scripts or restyle the editor.
Settings
| Setting |
Values |
Default |
drakonFlowcharts.colorTheme |
semantic (By meaning), vscode (VS Code colors), paper (Black and white), classic |
semantic |
Roadmap
A rich text editor for icon text, as in DrakonHub: bold, italics and lists without writing HTML.
Credits
- The DRAKON language was created by Vladimir Parondzhanov.
- The diagrams are laid out and drawn by DrakonWidget
by Stepan Mitkin, released into the public domain (Unlicense).
License
MIT. Building and testing the extension: DEVELOPMENT.md (in Russian).
| |