* develop: (59 commits) docs: Update mermaid.init remove date docs: Remove incorrect = chore: Prettier format chore: Update config.type.ts chore Add vitest.workspace.js chore: Stricter TS version chore: Remove MermaidAPI from docs doc: Update deprecation message doc: Update deprecation message fix: prevent escaping label styles chore: update browsers list chore(deps): update all patch dependencies docs: Added demo diagram of bidirectional arrows for sequence diagrams fix(deps): update all patch dependencies chore: Update drupal regex chore: Update pnpm chore: Update docs to remove html tag like text rebuild chore: Use string templates chore: Update docs ...
30 KiB
Warning
THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
Please edit the corresponding file in /packages/mermaid/src/docs/config/setup/interfaces/mermaid.Mermaid.md.
Interface: Mermaid
mermaid.Mermaid
Properties
contentLoaded
• contentLoaded: () => void
Type declaration
▸ (): void
##contentLoaded Callback function that is called when page is loaded. This functions fetches configuration for mermaid rendering and calls init for rendering the mermaid diagrams on the page.
Returns
void
Defined in
packages/mermaid/src/mermaid.ts:430
detectType
• detectType: (text
: string
, config?
: MermaidConfig
) => string
Type declaration
▸ (text
, config?
): string
Detects the type of the graph text.
Takes into consideration the possible existence of an %%init
directive
Parameters
Name | Type | Description |
---|---|---|
text |
string |
The text defining the graph. For example: mermaid %%{initialize: {"startOnLoad": true, logLevel: "fatal" }}%% graph LR a-->b b-->c c-->d d-->e e-->f f-->g g-->h |
config? |
MermaidConfig |
The mermaid config. |
Returns
string
A graph definition key
Defined in
packages/mermaid/src/mermaid.ts:432
init
• init: (config?
: MermaidConfig
, nodes?
: string
| HTMLElement
| NodeListOf
<HTMLElement
>, callback?
: (id
: string
) => unknown
) => Promise
<void
>
Deprecated
Use initialize and run instead.
Type declaration
▸ (config?
, nodes?
, callback?
): Promise
<void
>
Parameters
Name | Type |
---|---|
config? |
MermaidConfig |
nodes? |
string | HTMLElement | NodeListOf <HTMLElement > |
callback? |
(id : string ) => unknown |
Returns
Promise
<void
>
Defined in
packages/mermaid/src/mermaid.ts:425
initialize
• initialize: (config
: MermaidConfig
) => void
Type declaration
▸ (config
): void
Used to set configurations for mermaid. This function should be called before the run function.
Parameters
Name | Type | Description |
---|---|---|
config |
MermaidConfig |
Configuration object for mermaid. |
Returns
void
Defined in
packages/mermaid/src/mermaid.ts:429
internalHelpers
• internalHelpers: Object
Internal helpers for mermaid
Deprecated
- This should not be used by external packages, as the definitions will change without notice.
Type declaration
Name | Type |
---|---|
common |
{ evaluate : (val? : string | boolean ) => boolean ; getMax : (...values : number []) => number ; getMin : (...values : number []) => number ; getRows : (s? : string ) => string [] ; getUrl : (useAbsolute : boolean ) => string ; hasBreaks : (text : string ) => boolean ; lineBreakRegex : RegExp ; removeScript : (txt : string ) => string ; sanitizeText : (text : string , config : MermaidConfig ) => string ; sanitizeTextOrArray : (a : string | string [] | string [][], config : MermaidConfig ) => string | string [] ; splitBreaks : (text : string ) => string [] } |
common.evaluate |
(val? : string | boolean ) => boolean |
common.getMax |
(...values : number []) => number |
common.getMin |
(...values : number []) => number |
common.getRows |
(s? : string ) => string [] |
common.getUrl |
(useAbsolute : boolean ) => string |
common.hasBreaks |
(text : string ) => boolean |
common.lineBreakRegex |
RegExp |
common.removeScript |
(txt : string ) => string |
common.sanitizeText |
(text : string , config : MermaidConfig ) => string |
common.sanitizeTextOrArray |
(a : string | string [] | string [][], config : MermaidConfig ) => string | string [] |
common.splitBreaks |
(text : string ) => string [] |
getConfig |
() => MermaidConfig |
insertCluster |
(elem : any , node : any ) => any |
insertEdge |
(elem : any , edge : any , clusterDb : any , diagramType : any , startNode : any , endNode : any , id : any ) => { originalPath : any ; updatedPath : any } |
insertEdgeLabel |
(elem : any , edge : any ) => Promise <any > |
insertMarkers |
(elem : any , markerArray : any , type : any , id : any ) => void |
insertNode |
(elem : any , node : any , dir : any ) => Promise <any > |
interpolateToCurve |
(interpolate : undefined | string , defaultCurve : CurveFactory ) => CurveFactory |
labelHelper |
(parent : any , node : any , _classes : any ) => Promise <{ bbox : any ; halfPadding : number ; label : any = labelEl; shapeSvg : any }> |
log |
Record <LogLevel , (...data : any []) => void (message? : any , ...optionalParams : any []) => void > |
positionEdgeLabel |
(edge : any , paths : any ) => void |
Defined in
packages/mermaid/src/mermaid.ts:437
mermaidAPI
• mermaidAPI: Readonly
<{ defaultConfig
: MermaidConfig
= configApi.defaultConfig; getConfig
: () => MermaidConfig
= configApi.getConfig; getDiagramFromText
: (text
: string
, metadata
: Pick
<DiagramMetadata
, "title"
>) => Promise
<Diagram
> ; getSiteConfig
: () => MermaidConfig
= configApi.getSiteConfig; globalReset
: () => void
; initialize
: (options
: MermaidConfig
) => void
; parse
: (text
: string
, parseOptions
: ParseOptions
& { suppressErrors
: true
}) => Promise
<ParseResult
| false
>(text
: string
, parseOptions?
: ParseOptions
) => Promise
<ParseResult
> ; render
: (id
: string
, text
: string
, svgContainingElement?
: Element
) => Promise
<RenderResult
> ; reset
: () => void
; setConfig
: (conf
: MermaidConfig
) => MermaidConfig
= configApi.setConfig; updateSiteConfig
: (conf
: MermaidConfig
) => MermaidConfig
= configApi.updateSiteConfig }>
Deprecated
Use parse and render instead. Please open a discussion if your use case does not fit the new API.
Defined in
packages/mermaid/src/mermaid.ts:419
parse
• parse: (text
: string
, parseOptions
: ParseOptions
& { suppressErrors
: true
}) => Promise
<ParseResult
| false
>(text
: string
, parseOptions?
: ParseOptions
) => Promise
<ParseResult
>
Type declaration
▸ (text
, parseOptions
): Promise
<ParseResult
| false
>
Parse the text and validate the syntax.
Parameters
Name | Type | Description |
---|---|---|
text |
string |
The mermaid diagram definition. |
parseOptions |
ParseOptions & { suppressErrors : true } |
Options for parsing. |
Returns
Promise
<ParseResult
| false
>
An object with the diagramType
set to type of the diagram if valid. Otherwise false
if parseOptions.suppressErrors is true
.
See
Throws
Error if the diagram is invalid and parseOptions.suppressErrors is false or not set.
▸ (text
, parseOptions?
): Promise
<ParseResult
>
Parameters
Name | Type |
---|---|
text |
string |
parseOptions? |
ParseOptions |
Returns
Promise
<ParseResult
>
Defined in
packages/mermaid/src/mermaid.ts:420
parseError
• Optional
parseError: ParseErrorFunction
Defined in
packages/mermaid/src/mermaid.ts:414
registerExternalDiagrams
• registerExternalDiagrams: (diagrams
: ExternalDiagramDefinition
[], opts
: { lazyLoad?
: boolean
= true }) => Promise
<void
>
Type declaration
▸ (diagrams
, opts?
): Promise
<void
>
Used to register external diagram types.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
diagrams |
ExternalDiagramDefinition [] |
undefined |
Array of ExternalDiagramDefinition. |
opts |
Object |
{} |
If opts.lazyLoad is false, the diagrams will be loaded immediately. |
opts.lazyLoad? |
boolean |
true |
- |
Returns
Promise
<void
>
Defined in
packages/mermaid/src/mermaid.ts:428
registerLayoutLoaders
• registerLayoutLoaders: (loaders
: LayoutLoaderDefinition
[]) => void
Type declaration
▸ (loaders
): void
Parameters
Name | Type |
---|---|
loaders |
LayoutLoaderDefinition [] |
Returns
void
Defined in
packages/mermaid/src/mermaid.ts:427
render
• render: (id
: string
, text
: string
, svgContainingElement?
: Element
) => Promise
<RenderResult
>
Type declaration
▸ (id
, text
, svgContainingElement?
): Promise
<RenderResult
>
Parameters
Name | Type |
---|---|
id |
string |
text |
string |
svgContainingElement? |
Element |
Returns
Promise
<RenderResult
>
Defined in
packages/mermaid/src/mermaid.ts:421
run
• run: (options
: RunOptions
) => Promise
<void
>
Type declaration
▸ (options?
): Promise
<void
>
run
Function that goes through the document to find the chart definitions in there and render them.
The function tags the processed attributes with the attribute data-processed and ignores found elements with the attribute already set. This way the init function can be triggered several times.
graph LR;
a(Find elements)-->b{Processed}
b-->|Yes|c(Leave element)
b-->|No |d(Transform)
graph LR;
a(Find elements)-->b{Processed}
b-->|Yes|c(Leave element)
b-->|No |d(Transform)
Renders the mermaid diagrams
Parameters
Name | Type | Description |
---|---|---|
options |
RunOptions |
Optional runtime configs |
Returns
Promise
<void
>
Defined in
packages/mermaid/src/mermaid.ts:426
setParseErrorHandler
• setParseErrorHandler: (parseErrorHandler
: (err
: any
, hash
: any
) => void
) => void
Type declaration
▸ (parseErrorHandler
): void
setParseErrorHandler Alternative to directly setting parseError using:
mermaid.parseError = function (err, hash) {
forExampleDisplayErrorInGui(err); // do something with the error
};
This is provided for environments where the mermaid object can't directly have a new member added to it (eg. dart interop wrapper). (Initially there is no parseError member of mermaid).
Parameters
Name | Type | Description |
---|---|---|
parseErrorHandler |
(err : any , hash : any ) => void |
New parseError() callback. |
Returns
void
Defined in
packages/mermaid/src/mermaid.ts:431
startOnLoad
• startOnLoad: boolean