Mermaid diagrams
Lineout converts Mermaid flowcharts, sequence diagrams, state diagrams and use case diagrams into ordinary shapes, groups, frames and arrows, laid out automatically. The conversion happens once: the result is a page you edit like any other.
flowchart LR
user([User]) --> api[API Gateway]
api -->|invoke| fn[Lambda]
fn --> db[(Orders)]Bringing a diagram in#
| Where | How |
|---|---|
| Canvas | Paste the text. If it can't be read, a dialog shows the line to fix. See Copy and paste. |
| Code panel | Add from Mermaid… adds it to the current page. See Code panel. |
| Command palette | New page from Mermaid adds it as a page, named after its title. |
| Dashboard | Drop .mmd or .mermaid files on a project. See Importing diagrams. |
| MCP | create_diagram and add_page accept Mermaid text. See Mermaid content. |
Every diagram can start with a frontmatter title, which names the page. %% comments, %%{init: …}%% directives and a surrounding mermaid code fence are ignored. Other kinds of Mermaid diagrams, such as class or entity relationship diagrams, aren't supported.
Flowcharts#
A flowchart starts with flowchart or graph and a direction: TB or TD, top to bottom by default, BT, LR or RL. click, accTitle and accDescr lines are skipped.
Nodes#
A node's text comes from its brackets or from label: in its shape data, else from its id. <br> starts a new line, and entity codes such as #quot; are decoded.
| Mermaid | Lineout |
|---|---|
A[Text], A[[Text]], A>Text] | Rectangle |
A(Text), A([Text]) | Rounded rectangle |
A((Text)), A(((Text))) | Circle |
A{Text} | Diamond |
A{{Text}} | Hexagon |
A[(Text)] | Cylinder |
A[/Text/], A[\Text\] | Parallelogram |
A[/Text\], A[\Text/] | Rectangle |
A@{ shape: tri, label: "Text" } | The shape in the table below |
A@{ icon: "AWS-Lambda", label: "Text" } | Icon node |
Shape data names every Mermaid shape, and several map to the same Lineout shape:
| Lineout | Mermaid shape names |
|---|---|
| Rectangle | rect, fr-rect, notch-rect, lin-rect, div-rect, st-rect, tag-rect, sl-rect, bow-rect, win-pane, doc, lin-doc, docs, tag-doc, flag, odd, curv-trap, trap-t, trap-b, bolt, datastore, folder, browser, console, cloud, bang |
| Rounded rectangle | rounded, stadium, delay |
| Circle | circle, dbl-circ |
| Filled circle | sm-circ, f-circ |
| Bullseye | fr-circ |
| Crossed circle | cross-circ |
| Diamond | diam |
| Hexagon | hex |
| Cylinder | cyl, h-cyl, lin-cyl, bucket |
| Parallelogram | lean-r, lean-l |
| Triangle | tri, flip-tri |
| Pentagon | notch-pent |
| Hourglass | hourglass |
| Bar | fork |
| Actor | person |
| Text node | text, brace, brace-r, braces |
- Shapes are sized to fit their text. The filled circle, bullseye, crossed circle, bar and hourglass show a label under the shape, and only one set with
label:. personbecomes an actor, a stick figure with its text under it.iconis a Lineout icon name, such asAWS-LambdaorGeneric_Router, or an icon pack name such aslogos:aws-lambda, which is matched to Lineout's icons. An unknown icon becomes a rounded rectangle.
Subgraphs#
Each subgraph … end becomes a group around its nodes, and subgraphs nest. subgraph vpc [Production network] gives the group the id vpc and the title "Production network". Its corner icon comes from:
- A
vpc@{ icon: "Virtual-private-cloud-VPC" }line, a Lineout extension that Mermaid itself doesn't support. - A title that names a group icon, such as "AWS Cloud", "Region", "VPC", "Private subnet" or "Data center".
- Otherwise, a plain grey group.
Cost estimates only count services inside an AWS Cloud group, so title a subgraph "AWS Cloud" to get an estimate.
A direction inside a subgraph applies when the subgraph holds no other subgraphs and none of its nodes link outside it. Otherwise it follows the flowchart's direction, as in Mermaid.
Links#
| Mermaid | Lineout |
|---|---|
A --> B | Arrow |
A --- B | Line without an arrowhead |
A <--> B | Arrowheads at both ends |
A --x B | Arrow with a cross |
A --o B | Arrow, since Lineout has no circle head |
A -.-> B | Dashed arrow |
A ==> B | Thicker arrow |
A ~~~ B | No arrow, but B is placed after A |
A -->|HTTPS| B, A -- HTTPS --> B | Labeled arrow |
Chains such as A --> B --> C and A & B --> C & D make an arrow for every pair, and extra dashes, as in A ---> B, add room between the nodes. A link to a subgraph's id attaches to the group. Arrows that pass other nodes get pinned routes. See Routes.
Styles#
style, classDef, class, A:::className and linkStyle carry over:
| Property | Lineout |
|---|---|
fill | Fill of a shape or group |
stroke | Border color, or line color for links |
stroke-width | Border or line width |
stroke-dasharray | Dashed border or line |
color | Text color |
font-weight, font-style | Bold and italic text |
Colors can be hex, rgb(), Lineout palette names such as red, or common CSS names such as navy, which become the closest palette color. Other properties are ignored. State and use case diagrams take the same styles.
Activity diagrams#
A UML activity diagram is a flowchart with UML shapes: start for the initial node, stop for the final node, fork or join for bars across the flow, cross-circ for a flow final and hourglass for a time event, with A{Decision} for decisions and merges.
flowchart TB
start@{ shape: start } --> receive([Receive order]) --> stock{In stock?}
stock -->|yes| fork@{ shape: fork }
stock -->|no| cancel@{ shape: cross-circ, label: "Cancelled" }
fork --> ship[Ship] --> join@{ shape: join }
fork --> bill[Bill] --> join
join --> stop@{ shape: stop }Sequence diagrams#
sequenceDiagram becomes lifelines side by side, with a row per message. A title line names the page.
| Mermaid | Lineout |
|---|---|
participant A as Web app, actor U as User | Box and actor lifelines, in order. Undeclared participants are added as they appear, and ids become node ids. |
A->>B, A-->>B, A-)B, A-xB, A->B, A-->B, A<<->>B | Filled head, dashed, open head, cross, no head, dashed without head, both ends. |
A->>+B, activate B … B-->>-A, deactivate B | Activation bars, with nested ones a little to the right. |
loop, alt/else, opt, par/and, critical/option, break … end | Combined fragments with their operator, condition and dividers. |
rect rgb(…) … end | A filled frame. |
Note right of A, Note left of A, Note over A,B | Notes. |
create participant B, destroy B | A lifeline that starts at its creating message, or ends with a cross. |
box Purple Team … end | A frame named "Team", filled with the closest palette color. |
Messages to the sender loop back to its lifeline, autonumber numbers the messages, and arrows are named m1, m2 and so on. link, links, properties, details, accTitle and accDescr lines are skipped.
State diagrams#
stateDiagram-v2 or stateDiagram reads top to bottom unless it sets a direction.
| Mermaid | Lineout |
|---|---|
A --> B: event | A transition. |
[*] --> A, A --> [*] | Initial and final states, one of each per composite state. |
state "Long name" as A, A: description | The state's text. |
state C <<choice>>, <<fork>>, <<join>> | A small diamond, and bars. |
state Composite { … }, with -- between parts | A composite state with rounded corners, split into concurrent regions. |
note right of A: text, or note left of A … end note | A note linked to the state with a dashed line. |
classDef, class, A:::className and style apply the styles above.
Use case diagrams#
usecase-beta, which Mermaid still marks as beta, reads left to right unless it sets a direction.
| Mermaid | Lineout |
|---|---|
actor Customer, actor Admin("Administrator") | Actors. |
Login("Sign in"), "Reset password" | Use cases. Anything a relationship names that isn't declared too. |
Report[Generate report], json nodes | Rectangles. |
systemBoundary shop["Online shop"] … end | A frame around its use cases, with a tab for @{ type: package }. |
Customer --> Login, A --- B, A <-- B | Associations, with a head, without one, or pointing back. |
Checkout ..> : include Payment, Coupon ..> : extend Checkout | Dashed arrows with open heads, labeled «include» and «extend». |
Admin --|> Person | A generalization with a hollow head. |
A -- "label" --> B | A labeled association. |
note for Login "text" | A note linked to the use case. |
Stereotypes such as <<Core>> are added above the name.
Limits#
| Limit | Value |
|---|---|
| Nodes | 500 |
| Links, transitions, relationships or messages | 1000 |
| Text | 200,000 characters |
Lineout also refuses a diagram whose layout would be too much work, with "the diagram is too large to lay out". This happens when many links skip across hundreds of nodes, or when many subgraphs nest around a long chain: split such a diagram up. The same text always gives the same page, wherever it comes from.