mermaid.svg.paint

mermaid.svg

paint(frame, opts) -> svg

Paint a frame as one SVG string

Returns one string, from <svg to </svg>. It is also a whole SVG file.

opts:

FieldHolds
cell_w, cell_ha cell's size in user units; 10 by 20 when not given

One user unit is one CSS pixel at the picture's own size. The root's width and height give that size, and its viewBox lets a stylesheet shrink it. A stroke is a tenth of cell_h, the font eight tenths.

The paint order is the frame's: groups, boxes, routes and their markers, then the texts in one <g>.

ElementClass
the rootdiagram-flowchart or diagram-sequence, by frame.kind; none for a frame with no kind
a group, a box, a route, a textdiagram- and its style, each dot a dash
a markerits route's class and diagram-marker

The root names the picture for a reader who cannot see it. With frame.title, the root is role="img" and its aria-label is the title: a screen reader reads the title and skips the labels. With no title, the root has no role and its aria-label is the kind's name, or diagram: the labels are read as text. frame.descr, when there is one, is a <desc>, the root's first child. There is no <title> element: a browser shows one as a tooltip over the whole picture.

The frame must pass mermaid.frame.check. The painter raises nothing on a checked frame.