mermaidApiRender function
Used to render a graph and receive have the source for the created SVG file.
The complete SVG file will be returned and sent to the bindingCallback
if one
is provided. The bindingCallback
callback only needs to be used if you want to
use the bindingCallback
to allow mermaid to bind event handlers to the element
within the DOM that you are placing the SVG file within.
idOfAScratchDivToCreate
is a NEVER BEFORE USED html element ID that can
use used to create a scratch div (or iframe for sandbox mode). This element
will BE REMOVED from the dom before this returns, so DO NOT pass in id's of
existing elements.
NOTE: This MUST BE a id that was NEVER passed into render() previously -
re-using the same scratch ID will not work. The DART mermaidApi.render()
wrapper function will automatically generate random IDs if '' or null is
passed for the idOfAScratchDivToCreate
parameter.
diagramDef
is the source for the diagram being rendered.
bindingCallback
is the callback that will be called with the SVG code and
binding callback-callback.
scratchElementWhereMermaidWillMakeSVG
is a scratch div within the dom
that mermaid can use. The idOfAScratchDivToCreate
must STILL BE a unique
ID when using the scratchElementWhereMermaidWillMakeSVG
parameter.
The underlying JS mermaid library is very peculiar behavior here that I cannot
explain.
Implementation
@JS("mermaidAPI.render")
external String mermaidApiRender(
String idOfAScratchDivToCreate, String diagramDef,
[void Function(String svgCode, void Function(Element element))?
bindingCallback,
Element? scratchElementWhereMermaidWillMakeSVG]);