primitive shapes

The base shapes a diagram is built from — everything else (flowchart nodes, cards, trees) lowers to these. They live inside a diagram and are placed by x / y (or anchors). The five simplest, side by side:

Preview

rectcirclelineAapolygonlabel
rectcirclelineAapolygonlabel

Example

diagram {
  width = 360
  height = 230
  rect {
    x = 35.0
    y = 30.0
    width = 70.0
    height = 50.0
    fill = "#88c0d0"
    stroke = "#333"
  }
  circle {
    cx = 180.0
    cy = 55.0
    r = 25.0
    fill = "#8fbcbb"
    stroke = "#333"
  }
  line {
    x1 = 260.0
    y1 = 80.0
    x2 = 320.0
    y2 = 30.0
    stroke = "#bf616a"
  }
  label "rect" {
    x = 70.0
    y = 102.0
    font_size = 12.0
    fill = "#888"
  }
  label "circle" {
    x = 180.0
    y = 102.0
    font_size = 12.0
    fill = "#888"
  }
  label "line" {
    x = 290.0
    y = 102.0
    font_size = 12.0
    fill = "#888"
  }
  polygon {
    points = "40,190 70,140 100,190"
    fill = "#ebcb8b"
    stroke = "#333"
  }
  label "Aa" {
    x = 180.0
    y = 178.0
    font_size = 26.0
    fill = "#5e81ac"
  }
  label "polygon" {
    x = 70.0
    y = 212.0
    font_size = 12.0
    fill = "#888"
  }
  label "label" {
    x = 180.0
    y = 212.0
    font_size = 12.0
    fill = "#888"
  }
}

An axis-aligned rectangle — the workhorse box.

PropertyTypeRequiredDescription
xf64noTop-left x corner, in canvas pixels.
yf64noTop-left y corner, in canvas pixels.
widthf64noBox width.
heightf64noBox height.
fillutf8noFill colour.
strokeutf8noOutline colour.
ididentifiernoName used to connect the shape (a -> b) and to anchor others to it.
classlist<utf8>noStyle classes — text and SVG paint via the class system.
anchor_leftf64noFractional anchor (0–1) pinning the left edge to the parent box.
anchor_rightf64noFractional anchor (0–1) pinning the right edge to the parent box.
anchor_topf64noFractional anchor (0–1) pinning the top edge to the parent box.
anchor_bottomf64noFractional anchor (0–1) pinning the bottom edge to the parent box.
connect_pointslist<AnchorSide>noWhich sides (:left/:right/:top/:bottom) edges attach to.
iconutf8noIcon-badge icon (a pack.name).
icon_sizef64noIcon-badge size.
icon_posIconPosnoIcon-badge position (:center / :top_left / …).
icon_classlist<utf8>noIcon-badge style classes.
linkutf8noLink the shape to an in-site page (bare page name, or site:page). Wraps it in a clickable <a>; an unknown page fails the build like a bad prose link.

A circle placed by its centre and radius.

PropertyTypeRequiredDescription
cxf64noCentre x point.
cyf64noCentre y point.
rf64noRadius.
fillutf8noFill colour.
strokeutf8noOutline colour.
ididentifiernoName used to connect the shape (a -> b) and to anchor others to it.
classlist<utf8>noStyle classes — text and SVG paint via the class system.
anchor_leftf64noFractional anchor (0–1) pinning the left edge to the parent box.
anchor_rightf64noFractional anchor (0–1) pinning the right edge to the parent box.
anchor_topf64noFractional anchor (0–1) pinning the top edge to the parent box.
anchor_bottomf64noFractional anchor (0–1) pinning the bottom edge to the parent box.
connect_pointslist<AnchorSide>noWhich sides (:left/:right/:top/:bottom) edges attach to.
iconutf8noIcon-badge icon (a pack.name).
icon_sizef64noIcon-badge size.
icon_posIconPosnoIcon-badge position (:center / :top_left / …).
icon_classlist<utf8>noIcon-badge style classes.
linkutf8noLink the shape to an in-site page (bare page name, or site:page). Wraps it in a clickable <a>; an unknown page fails the build like a bad prose link.

A straight segment between two points.

PropertyTypeRequiredDescription
x1f64noStart-point x.
y1f64noStart-point y.
x2f64noEnd-point x.
y2f64noEnd-point y.
strokeutf8noLine colour.
ididentifiernoName used to connect the shape (a -> b) and to anchor others to it.
classlist<utf8>noStyle classes — text and SVG paint via the class system.
anchor_leftf64noFractional anchor (0–1) pinning the left edge to the parent box.
anchor_rightf64noFractional anchor (0–1) pinning the right edge to the parent box.
anchor_topf64noFractional anchor (0–1) pinning the top edge to the parent box.
anchor_bottomf64noFractional anchor (0–1) pinning the bottom edge to the parent box.
connect_pointslist<AnchorSide>noWhich sides (:left/:right/:top/:bottom) edges attach to.
linkutf8noLink the shape to an in-site page (bare page name, or site:page). Wraps it in a clickable <a>; an unknown page fails the build like a bad prose link.

A free-floating text label.

PropertyTypeRequiredDescription
contentutf8yesThe text, given as the inline label: label "halfway" { … }.
xf64noAnchor x position.
yf64noAnchor y position.
font_sizef64noExplicit font size; when omitted the text auto-fits its region.
fit_widthf64noWidth of the region the text is auto-sized to fit (when font_size is unset).
fit_heightf64noHeight of the region the text is auto-sized to fit (when font_size is unset).
fillutf8noText colour.
ididentifiernoName used to connect the shape (a -> b) and to anchor others to it.
classlist<utf8>noStyle classes — text and SVG paint via the class system.
anchor_leftf64noFractional anchor (0–1) pinning the left edge to the parent box.
anchor_rightf64noFractional anchor (0–1) pinning the right edge to the parent box.
anchor_topf64noFractional anchor (0–1) pinning the top edge to the parent box.
anchor_bottomf64noFractional anchor (0–1) pinning the bottom edge to the parent box.
connect_pointslist<AnchorSide>noWhich sides (:left/:right/:top/:bottom) edges attach to.
linkutf8noLink the shape to an in-site page (bare page name, or site:page). Wraps it in a clickable <a>; an unknown page fails the build like a bad prose link.

An arbitrary closed shape from a point list.

PropertyTypeRequiredDescription
pointsutf8yesSpace-separated x,y pairs, e.g. "180,10 230,40 180,70".
fillutf8noFill colour.
strokeutf8noOutline colour.
ididentifiernoName used to connect the shape (a -> b) and to anchor others to it.
classlist<utf8>noStyle classes — text and SVG paint via the class system.
anchor_leftf64noFractional anchor (0–1) pinning the left edge to the parent box.
anchor_rightf64noFractional anchor (0–1) pinning the right edge to the parent box.
anchor_topf64noFractional anchor (0–1) pinning the top edge to the parent box.
anchor_bottomf64noFractional anchor (0–1) pinning the bottom edge to the parent box.
connect_pointslist<AnchorSide>noWhich sides (:left/:right/:top/:bottom) edges attach to.
linkutf8noLink the shape to an in-site page (bare page name, or site:page). Wraps it in a clickable <a>; an unknown page fails the build like a bad prose link.

Composite shapes — container, card, node_table — get their own page; see composite shapes. Paint them with the class system.