mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-22 00:40:22 +02:00
chore: Add docs
This commit is contained in:
@@ -97,7 +97,7 @@ mermaid.initialize(config);
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[mermaidAPI.ts:624](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L624)
|
[mermaidAPI.ts:623](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L623)
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ Return the last node appended
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[mermaidAPI.ts:278](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L278)
|
[mermaidAPI.ts:277](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L277)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ the cleaned up svgCode
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[mermaidAPI.ts:224](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L224)
|
[mermaidAPI.ts:223](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L223)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ the string with all the user styles
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[mermaidAPI.ts:154](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L154)
|
[mermaidAPI.ts:153](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L153)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ the string with all the user styles
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[mermaidAPI.ts:201](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L201)
|
[mermaidAPI.ts:200](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L200)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -229,7 +229,7 @@ with an enclosing block that has each of the cssClasses followed by !important;
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[mermaidAPI.ts:139](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L139)
|
[mermaidAPI.ts:138](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L138)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ Put the svgCode into an iFrame. Return the iFrame code
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[mermaidAPI.ts:255](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L255)
|
[mermaidAPI.ts:254](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L254)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -280,4 +280,4 @@ Remove any existing elements from the given document
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[mermaidAPI.ts:328](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L328)
|
[mermaidAPI.ts:327](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L327)
|
||||||
|
@@ -314,9 +314,21 @@ const executeQueue = async () => {
|
|||||||
/**
|
/**
|
||||||
* Parse the text and validate the syntax.
|
* Parse the text and validate the syntax.
|
||||||
* @param text - The mermaid diagram definition.
|
* @param text - The mermaid diagram definition.
|
||||||
* @param parseOptions - Options for parsing.
|
* @param parseOptions - Options for parsing. @see {@link ParseOptions}
|
||||||
* @returns An object with the diagramType set to type of the diagram if valid. Otherwise false if parseOptions.suppressErrors is true.
|
* @returns If valid, {@link ParseResult} otherwise `false` if parseOptions.suppressErrors is `true`.
|
||||||
* @throws Error if the diagram is invalid and parseOptions.suppressErrors is false or not set.
|
* @throws Error if the diagram is invalid and parseOptions.suppressErrors is false or not set.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* console.log(await mermaid.parse('flowchart \n a --> b'));
|
||||||
|
* // { diagramType: 'flowchart-v2' }
|
||||||
|
* console.log(await mermaid.parse('wrong \n a --> b', { suppressErrors: true }));
|
||||||
|
* // false
|
||||||
|
* console.log(await mermaid.parse('wrong \n a --> b', { suppressErrors: false }));
|
||||||
|
* // throws Error
|
||||||
|
* console.log(await mermaid.parse('wrong \n a --> b'));
|
||||||
|
* // throws Error
|
||||||
|
* ```
|
||||||
*/
|
*/
|
||||||
const parse: typeof mermaidAPI.parse = async (text, parseOptions) => {
|
const parse: typeof mermaidAPI.parse = async (text, parseOptions) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
@@ -108,7 +108,6 @@ function processAndSetConfigs(text: string) {
|
|||||||
* @returns An object with the `diagramType` set to type of the diagram if valid. Otherwise `false` if parseOptions.suppressErrors is `true`.
|
* @returns An object with the `diagramType` set to type of the diagram if valid. Otherwise `false` if parseOptions.suppressErrors is `true`.
|
||||||
* @throws Error if the diagram is invalid and parseOptions.suppressErrors is false or not set.
|
* @throws Error if the diagram is invalid and parseOptions.suppressErrors is false or not set.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
async function parse(
|
async function parse(
|
||||||
text: string,
|
text: string,
|
||||||
parseOptions: ParseOptions & { suppressErrors: true }
|
parseOptions: ParseOptions & { suppressErrors: true }
|
||||||
|
Reference in New Issue
Block a user