Mermaid reference: the editor
On this page
The editor opens by itself when you insert a Mermaid Diagram. Later, it opens from Edit on the selected diagram. A click inside the diagram does not select it; see Change a diagram later.
- Panes. Source and preview sit side by side when the editor is at least 900 px wide, and stack below that.
- Preview. It redraws 250 ms after you stop typing.
- Source. Syntax highlighting, line numbers and wrapped lines. Ctrl+Z undoes and Ctrl+F opens find and replace; on a Mac, use Cmd. Tab and Shift+Tab indent and outdent the lines the selection touches, by two spaces. Esc, then Tab within two seconds, moves focus on. Ctrl+M (Shift+Alt+M on a Mac) switches Tab between indenting and moving focus until pressed again. The hint beside Diagram source shows the first two.
- Examples. Eight buttons, and a More… list with the other 24 kinds, which goes back to "More…" once an example is chosen. They stay available the whole time. If the source has text, a bar asks "Replace your diagram with the … example?" with Replace and Keep mine.
- Colours, Look and Layout. Three lists beside the examples. A new choice redraws the preview. See Colours and Look and layout.
- Syntax reference. It follows the first line of the source. It opens by itself when the diagram is empty.
- Alt text for screen readers. Up to 250 characters.
-
Size on the page. Under the preview; saved with the
diagram as
size. Readable (automatic), the default and what diagrams saved before 2.8 get: never larger than Mermaid draws it, and never below 65% (labels of about 10 px); a wider diagram scrolls sideways and fades at the edge it continues past. Fill the width: the page width, larger or smaller, as before 2.8 (zoom runs 25% to 400%). Actual size: as Mermaid draws it. - Action row. Save, Revert changes, Restore a previous version…, Cancel and Full documentation stay at the foot of the editor, however far it scrolls.
- License line. While the site's license is not active, a line at the top says "Editing needs an active licence for this app. The diagram still shows on the page as it was last saved.", with the price and "A site admin can subscribe to the app." The source is read-only, Save does not save, and the examples (the buttons and the More… list), history, Revert changes, Colours, Look, Layout, Size on the page, alt text and the AI prompts are off. The preview still draws and the source can be copied.
The evaluation note and the rating line
As the editor opens, it shows at most one line under Examples and Colours, the evaluation note first. Neither line blocks or changes anything else, and neither shows while the license is not active.
-
The evaluation note shows when Confluence hands
the editor a license with
isEvaluationset totruethat is not inactive. It reads "This site is evaluating the paid tier. Free for up to 10 users, then $0.35 per user per month for every user (less per user above 100 users). If the site does not subscribe, its diagrams keep showing on the pages as last saved, but can no longer be edited." It does not say how many days are left. Dismiss hides it in that browser for good. Where the editor cannot use the browser's storage, Dismiss hides it only until the editor next opens. -
The rating line reads "A rating on the Atlassian
Marketplace, good or bad, helps other Confluence teams decide
whether this app suits them." It shows when the diagram's
historyhas at least three versions and the oldest is at least 14 days old, the source is neither empty nor an untouched example, and the license is not inactive. History keeps the last five versions, so a diagram changed five or more times in the last 14 days waits. - Until one of its buttons is selected, the rating line shows each time the editor opens on such a diagram. Rate it opens the app's reviews on the Atlassian Marketplace and ends it in that browser. Not now hides it for 60 days, and after two Not nows it never shows again in that browser. Where the editor cannot read the browser's storage, it never shows.
Draft with AI and Fix with AI
- Draft with AI is a closed section between Examples and the source. It holds a request box, "What should the diagram show?", of up to 2,000 characters; Diagram type (Let the AI choose, or any of the 32 kinds); and Copy prompt.
- While the editor holds a diagram, it offers Change my diagram, which puts the source in the prompt and asks "What should change?", and Start a new one, which leaves it out. An untouched example starts a new one until you choose.
- Copy prompt is off until the box has text, with a line saying why. After a copy, Show prompt shows the exact text copied. If the browser refuses to copy, the prompt is shown selected for Ctrl+C.
- Fix with AI appears under a parse or drawing error. It copies the source and Mermaid's error as one prompt.
-
Both prompts ask for exactly one
```mermaidblock in the Mermaid version the app draws with, with no init directive, theme or front matter, and nothing the strict security level refuses. The paste clean-up keeps just that block. - A prompt holds the request, the source and the error. For one of the 24 kinds under More types, it also holds the editor's own example of that kind, so the AI sees the syntax. It holds nothing else from the page: not the alt text, the page or the versions. The app sends nothing to any AI.
Status line
| Message | When |
|---|---|
| "Pick an example to get started." | The source is empty |
| "Diagram is valid." | The source parses and draws |
| "Something looks wrong on line N", or "This diagram could not be read" | A parse or drawing error, with the text around it, a caret, sometimes a hint, and Fix with AI under it |
| "Saving…" | While Save runs |
| "Still loading the diagram…" | Save was selected before the diagram had loaded. Nothing is saved. |
| "Not saved yet. See the note above Save." | The diagram gets no picture for exports. See Saving without a picture. |
Save is off while there is a parse or drawing error. It stays on while the source is empty, and an empty diagram shows "No diagram yet" on the page.
Save checks the text as it is at the click. It waits for a preview still running, and checks the text itself when the preview has not caught up. Text that does not draw is not saved: the error shows under the source, with Fix with AI, and scrolls into view. While Save is off it stays in the tab order, described by the status line.
Saving without a picture
When a diagram gets no picture for exports, Save does not close the editor. A note above Save reads "Not saved yet: no picture for Word and PDF.", then why: "This diagram is too large or too slow to draw as a picture." or "Confluence did not accept this diagram with its picture." Focus moves to the note.
Save without picture saves the diagram with no picture, for the text, Colours, Look and Layout the note was about. An edit, or a new choice in one of those three lists, takes the note away, and Save tries the picture again.
Versions
- A save records the previous text as a version when the text changed and was not empty. Up to five are kept, newest first.
- Each version holds the text and the time, nothing else.
- Restore a previous version… appears once there is one. Each entry reads "age — first line", with the first line cut at 32 characters.
- Ages read "just now", "N min ago", "N h ago" or "N d ago".
- Choosing an entry loads its text into the editor. Nothing changes on the page until Save.
Other controls
- Revert changes restores the text the editor opened with. It is off while the text is unchanged.
- Cancel closes without saving. On a diagram that was just inserted, it removes the diagram.
- Full documentation opens the guide at eriksenlabs.com/docs through Confluence. Up to 2.6.0 it opened mermaid.js.org/intro/syntax-reference.html, and before 2.5.0 the link did not open.
Pasting
A paste is cleaned up when it holds wrapping that is never valid Mermaid. Everything runs in the browser.
| Pasted | Kept | The note says |
|---|---|---|
JSON with a diagramDefinition string, as some other Mermaid apps save it |
That string | "unwrapped the diagram from another app's saved format" |
| One macro copied from the storage format | Its diagramCode parameter if it has one, or else its CDATA body. A data: body is never taken. |
"took the diagram out of the page's storage format" |
One <pre class="mermaid"> or <div class="mermaid"> from a web page's HTML |
Its content, decoded and dedented | "took the diagram out of its HTML <pre> tag", or <div> |
One fence around the whole paste: ``` or ~~~, untagged or tagged mermaid in any case, {mermaid}, {.mermaid}, or ::: mermaid |
The fenced text | "removed the ```mermaid fence", naming the fence it found |
Other text with exactly one mermaid block |
That block | "kept only the ```mermaid block" |
HTML codes, when there is an escaped arrow or tag and no raw < or > |
The text, decoded | "turned HTML codes such as > back into characters", naming the first code |
One link to a diagram, and nothing else: a mermaid.live editor or viewer link (/edit#pako:…, /view#pako:…), an older link (#base64:…, or the first editor's #/edit/…), a picture link to mermaid.ink, what Copy Markdown gives, a playground link on mermaid.ai, a team's own copy of the editor, or a Kroki link to a Mermaid diagram |
The diagram's text, read out of the link's own text. The Mermaid configuration in the link, and everything else in it, is dropped | "took the diagram out of the pasted link" |
- A pasted link is never opened, and nothing is requested: the diagram is packed into the link itself, and the editor unpacks it in the browser. The text then goes through the preview's check like any other source.
- A link that cannot be read pastes nothing. A line under the status says why, and stays until the next edit: a link longer than 200,000 characters; one that is cut short or has been changed; one that carries no diagram, such as a link that loads its diagram from a file or a gist; and one that unpacks past 400,000 bytes, or whose diagram is longer than the 50,000 characters Mermaid draws.
-
A link in the middle of other text is pasted as text, and a
diagram that only mentions a link, in a
clickline, is not touched. -
Two or more
mermaidblocks are left as pasted. A fence without its closing line counts only when it is taggedmermaid. - Plain Mermaid goes in unchanged. So does a paste into several selections, or during text composition in an input method.
- The note reads "Cleaned up the pasted diagram: … Undo restores it as pasted." It shows for 8 seconds, or until the next edit.
- The clean-up is its own undo step. The first Ctrl+Z gives back the raw paste, and the second removes the paste.
- A diagram that opens as that JSON is unwrapped the same way. The note reads "Cleaned up this diagram: … Save to keep it." Undo or Revert changes brings back what was saved.
Guide: Paste from GitHub or another app and Moving a diagram from another Mermaid app.