mermaid/docs/config/setup/interfaces/mermaidAPI.RenderResult.md
Sidharth Vinod eaa84d2d91
feat: Break render and parse types
Both render and parse are async now.
Return type of render contains svg and bindFunctions.
Parse will not throw error if parseOptions.silent is passed.
2023-02-19 13:08:13 +05:30

1.8 KiB

Warning

THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.

Please edit the corresponding file in /packages/mermaid/src/docs/config/setup/interfaces/mermaidAPI.RenderResult.md.

Interface: RenderResult

mermaidAPI.RenderResult

Function that renders an svg with a graph from a chart definition. Usage example below.

mermaidAPI.initialize({
  startOnLoad: true,
});
$(function () {
  const graphDefinition = 'graph TB\na-->b';
  const cb = function (svgGraph) {
    console.log(svgGraph);
  };
  mermaidAPI.render('id1', graphDefinition, cb);
});

Param

The id for the SVG element (the element to be rendered)

Param

The text for the graph definition

Param

Callback which is called after rendering is finished with the svg code as in param.

Param

HTML element where the svg will be inserted. (Is usually element with the .mermaid class) If no svgContainingElement is provided then the SVG element will be appended to the body. Selector to element in which a div with the graph temporarily will be inserted. If one is provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is completed.

Properties

bindFunctions

Optional bindFunctions: (element: Element) => void

Type declaration

▸ (element): void

Parameters
Name Type
element Element
Returns

void

Defined in

mermaidAPI.ts:382


svg

svg: string

Defined in

mermaidAPI.ts:381