mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-18 23:09:49 +02:00
core: Fix render tsdoc
Co-authored-by: Dmitry Stratiychuk <dmstrati@microsoft.com>
This commit is contained in:
@@ -341,27 +341,21 @@ const parse = async (text: string, parseOptions?: ParseOptions): Promise<boolean
|
|||||||
* Function that renders an svg with a graph from a chart definition. Usage example below.
|
* Function that renders an svg with a graph from a chart definition. Usage example below.
|
||||||
*
|
*
|
||||||
* ```javascript
|
* ```javascript
|
||||||
* mermaid.initialize({
|
* element = document.querySelector('#graphDiv');
|
||||||
* startOnLoad: true,
|
* const graphDefinition = 'graph TB\na-->b';
|
||||||
* });
|
* const { svg, bindFunctions } = await mermaid.render('graphDiv', graphDefinition);
|
||||||
* $(function () {
|
* element.innerHTML = svg;
|
||||||
* const graphDefinition = 'graph TB\na-->b';
|
* bindFunctions?.(element);
|
||||||
* const cb = function (svgGraph) {
|
|
||||||
* console.log(svgGraph);
|
|
||||||
* };
|
|
||||||
* mermaid.render('id1', graphDefinition, cb);
|
|
||||||
* });
|
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param id - The id for the SVG element (the element to be rendered)
|
* @param id - The id for the SVG element (the element to be rendered)
|
||||||
* @param text - The text for the graph definition
|
* @param text - The text for the graph definition
|
||||||
* @param cb - Callback which is called after rendering is finished with the svg code as in param.
|
* @param container - HTML element where the svg will be inserted. (Is usually element with the .mermaid class)
|
||||||
* @param svgContainingElement - 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.
|
* 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
|
* 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
|
* 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.
|
* element will be removed when rendering is completed.
|
||||||
* @returns Returns the rendered element as a string containing the SVG definition.
|
* @returns Returns the SVG Definition and BindFunctions.
|
||||||
*/
|
*/
|
||||||
const render = (id: string, text: string, container?: Element): Promise<RenderResult> => {
|
const render = (id: string, text: string, container?: Element): Promise<RenderResult> => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
Reference in New Issue
Block a user