mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-21 06:53:17 +08:00
eaa84d2d91
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.
79 lines
1.8 KiB
Markdown
79 lines
1.8 KiB
Markdown
> **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](../../../../packages/mermaid/src/docs/config/setup/interfaces/mermaidAPI.RenderResult.md).
|
|
|
|
# Interface: RenderResult
|
|
|
|
[mermaidAPI](../modules/mermaidAPI.md).RenderResult
|
|
|
|
Function that renders an svg with a graph from a chart definition. Usage example below.
|
|
|
|
```javascript
|
|
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](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L382)
|
|
|
|
---
|
|
|
|
### svg
|
|
|
|
• **svg**: `string`
|
|
|
|
#### Defined in
|
|
|
|
[mermaidAPI.ts:381](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L381)
|