mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-14 12:59:46 +02:00

* develop: (138 commits) chore: Update docs chore: Add argos token to cypress config. chore: Remove cy.get('svg') calls chore: fix Argos parallel chore: Support local screenshot testing without applitools or argos chore: Skip checking drupal links chore: Remove reference screenshot generation from E2E chore: Remove cytoscape patch. chore(argos): disable matchImageSnapshot chore(argos): put parallel mode only when necessary chore(argos): setup parallel mode chore: setup Argos Visual Testing on E2E Fixed linters Added more specs for elk detector Fixed wrong elk detector, check only beginning of the line for diagram keywords Removed unused patch Fix cytoscape patch chore: Remove cytoscape patch. docs: fix node version in CONTRIBUTING.md Explain line breaks in `sequenceDiagram.md` ...
225 lines
8.5 KiB
Markdown
225 lines
8.5 KiB
Markdown
> **Warning**
|
|
>
|
|
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
|
|
>
|
|
> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/modules/mermaidAPI.md](../../../../packages/mermaid/src/docs/config/setup/modules/mermaidAPI.md).
|
|
|
|
# Module: mermaidAPI
|
|
|
|
## Interfaces
|
|
|
|
- [ParseOptions](../interfaces/mermaidAPI.ParseOptions.md)
|
|
- [ParseResult](../interfaces/mermaidAPI.ParseResult.md)
|
|
- [RenderResult](../interfaces/mermaidAPI.RenderResult.md)
|
|
|
|
## References
|
|
|
|
### default
|
|
|
|
Renames and re-exports [mermaidAPI](mermaidAPI.md#mermaidapi)
|
|
|
|
## Type Aliases
|
|
|
|
### D3Element
|
|
|
|
Ƭ **D3Element**: `any`
|
|
|
|
#### Defined in
|
|
|
|
[mermaidAPI.ts:74](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L74)
|
|
|
|
## Variables
|
|
|
|
### mermaidAPI
|
|
|
|
• `Const` **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`](../interfaces/mermaidAPI.ParseOptions.md) & { `suppressErrors`: `true` }) => `Promise`<[`ParseResult`](../interfaces/mermaidAPI.ParseResult.md) | `false`>(`text`: `string`, `parseOptions?`: [`ParseOptions`](../interfaces/mermaidAPI.ParseOptions.md)) => `Promise`<[`ParseResult`](../interfaces/mermaidAPI.ParseResult.md)> ; `render`: (`id`: `string`, `text`: `string`, `svgContainingElement?`: `Element`) => `Promise`<[`RenderResult`](../interfaces/mermaidAPI.RenderResult.md)> ; `reset`: () => `void` ; `setConfig`: (`conf`: `MermaidConfig`) => `MermaidConfig` = configApi.setConfig; `updateSiteConfig`: (`conf`: `MermaidConfig`) => `MermaidConfig` = configApi.updateSiteConfig }>
|
|
|
|
- Use mermaid.<function> instead of mermaid.mermaidAPI.<function>
|
|
|
|
#### Defined in
|
|
|
|
[mermaidAPI.ts:573](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L573)
|
|
|
|
## Functions
|
|
|
|
### appendDivSvgG
|
|
|
|
▸ **appendDivSvgG**(`parentRoot`, `id`, `enclosingDivId`, `divStyle?`, `svgXlink?`): `any`
|
|
|
|
Append an enclosing div, then svg, then g (group) to the d3 parentRoot. Set attributes.
|
|
Only set the style attribute on the enclosing div if divStyle is given.
|
|
Only set the xmlns:xlink attribute on svg if svgXlink is given.
|
|
Return the last node appended
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type | Description |
|
|
| :--------------- | :------- | :----------------------------------------------- |
|
|
| `parentRoot` | `any` | the d3 node to append things to |
|
|
| `id` | `string` | the value to set the id attr to |
|
|
| `enclosingDivId` | `string` | the id to set the enclosing div to |
|
|
| `divStyle?` | `string` | if given, the style to set the enclosing div to |
|
|
| `svgXlink?` | `string` | if given, the link to set the new svg element to |
|
|
|
|
#### Returns
|
|
|
|
`any`
|
|
|
|
- returns the parentRoot that had nodes appended
|
|
|
|
#### Defined in
|
|
|
|
[mermaidAPI.ts:276](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L276)
|
|
|
|
---
|
|
|
|
### cleanUpSvgCode
|
|
|
|
▸ **cleanUpSvgCode**(`svgCode?`, `inSandboxMode`, `useArrowMarkerUrls`): `string`
|
|
|
|
Clean up svgCode. Do replacements needed
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type | Default value | Description |
|
|
| :------------------- | :-------- | :------------ | :---------------------------------------------------------- |
|
|
| `svgCode` | `string` | `''` | the code to clean up |
|
|
| `inSandboxMode` | `boolean` | `undefined` | security level |
|
|
| `useArrowMarkerUrls` | `boolean` | `undefined` | should arrow marker's use full urls? (vs. just the anchors) |
|
|
|
|
#### Returns
|
|
|
|
`string`
|
|
|
|
the cleaned up svgCode
|
|
|
|
#### Defined in
|
|
|
|
[mermaidAPI.ts:222](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L222)
|
|
|
|
---
|
|
|
|
### createCssStyles
|
|
|
|
▸ **createCssStyles**(`config`, `classDefs?`): `string`
|
|
|
|
Create the user styles
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type | Description |
|
|
| :---------- | :--------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------ |
|
|
| `config` | `MermaidConfig` | configuration that has style and theme settings to use |
|
|
| `classDefs` | `undefined` \| `null` \| `Map`<`string`, `DiagramStyleClassDef`> | the classDefs in the diagram text. Might be null if none were defined. Usually is the result of a call to getClasses(...) |
|
|
|
|
#### Returns
|
|
|
|
`string`
|
|
|
|
the string with all the user styles
|
|
|
|
#### Defined in
|
|
|
|
[mermaidAPI.ts:153](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L153)
|
|
|
|
---
|
|
|
|
### createUserStyles
|
|
|
|
▸ **createUserStyles**(`config`, `graphType`, `classDefs`, `svgId`): `string`
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type |
|
|
| :---------- | :----------------------------------------------------- |
|
|
| `config` | `MermaidConfig` |
|
|
| `graphType` | `string` |
|
|
| `classDefs` | `undefined` \| `Map`<`string`, `DiagramStyleClassDef`> |
|
|
| `svgId` | `string` |
|
|
|
|
#### Returns
|
|
|
|
`string`
|
|
|
|
#### Defined in
|
|
|
|
[mermaidAPI.ts:199](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L199)
|
|
|
|
---
|
|
|
|
### cssImportantStyles
|
|
|
|
▸ **cssImportantStyles**(`cssClass`, `element`, `cssClasses?`): `string`
|
|
|
|
Create a CSS style that starts with the given class name, then the element,
|
|
with an enclosing block that has each of the cssClasses followed by !important;
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type | Default value | Description |
|
|
| :----------- | :---------- | :------------ | :--------------------------------------------- |
|
|
| `cssClass` | `string` | `undefined` | CSS class name |
|
|
| `element` | `string` | `undefined` | CSS element |
|
|
| `cssClasses` | `string`\[] | `[]` | list of CSS styles to append after the element |
|
|
|
|
#### Returns
|
|
|
|
`string`
|
|
|
|
- the constructed string
|
|
|
|
#### Defined in
|
|
|
|
[mermaidAPI.ts:138](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L138)
|
|
|
|
---
|
|
|
|
### putIntoIFrame
|
|
|
|
▸ **putIntoIFrame**(`svgCode?`, `svgElement?`): `string`
|
|
|
|
Put the svgCode into an iFrame. Return the iFrame code
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type | Default value | Description |
|
|
| :------------ | :------- | :------------ | :--------------------------------------------------------------------------- |
|
|
| `svgCode` | `string` | `''` | the svg code to put inside the iFrame |
|
|
| `svgElement?` | `any` | `undefined` | the d3 node that has the current svgElement so we can get the height from it |
|
|
|
|
#### Returns
|
|
|
|
`string`
|
|
|
|
- the code with the iFrame that now contains the svgCode
|
|
TODO replace btoa(). Replace with buf.toString('base64')?
|
|
|
|
#### Defined in
|
|
|
|
[mermaidAPI.ts:253](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L253)
|
|
|
|
---
|
|
|
|
### removeExistingElements
|
|
|
|
▸ **removeExistingElements**(`doc`, `id`, `divId`, `iFrameId`): `void`
|
|
|
|
Remove any existing elements from the given document
|
|
|
|
#### Parameters
|
|
|
|
| Name | Type | Description |
|
|
| :--------- | :--------- | :------------------------------------ |
|
|
| `doc` | `Document` | the document to removed elements from |
|
|
| `id` | `string` | id for any existing SVG element |
|
|
| `divId` | `string` | - |
|
|
| `iFrameId` | `string` | - |
|
|
|
|
#### Returns
|
|
|
|
`void`
|
|
|
|
#### Defined in
|
|
|
|
[mermaidAPI.ts:326](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L326)
|