mermaid.render

mermaid

render(source, opts) -> rows, err

Draw a diagram's source as rows

Lays the diagram out with layout and paints it. Returns one entry per row, each { runs = { ... } }; mermaid.text turns one into a line. rows.cols is the diagram's width in columns.

opts:

FieldHolds
max_colsthe widest diagram the caller can show
compactlay the diagram out compact from the start, whatever the room
turnedlay a flowchart out in its other flow, as layout does
painter"glyph", the default, or "pixel"
cell_w, cell_h, inks, strokewhat mermaid.pixel.paint reads

The glyph painter draws every stroke in box characters. Under the pixel painter a row's runs are its labels alone, and its strokes are a strip of pixels in row.strip, { w, h, cols, rgba }, to be shown under the row's text. A row with no stroke has false for its strip. Both painters give the same rows and columns, and the same labels at the same cells.

Returns nil and a reason when there is no picture to show: each refusal of layout, and "too wide" for a diagram wider than opts.max_cols even when laid out compact. The caller then shows the source.