docs: added warning and notes

This commit is contained in:
Emerson Bottero 2022-10-17 23:58:51 -03:00
parent c8b377bf74
commit c45bf055b6
40 changed files with 300 additions and 121 deletions

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Change Log
@ -13,10 +17,10 @@ All changes are in descending order, beginning with the newest (latest) version.
🔖 [Release Notes](https://github.com/mermaid-js/mermaid/releases/tag/8.7.0) |
📜 [Full Changelog](https://github.com/mermaid-js/mermaid/compare/8.6.0...8.7.0)
This version brings with it a system for [dynamic and integrated configuration of the diagram themes](../config/theming.md).
This version brings with it a system for [dynamic and integrated configuration of the diagram themes](config/theming.md).
The objective of this is to increase the customizability of mermaid and the ease of Styling, with the customization of themes through the `%%init%%` directive and `initialize` calls.
Themes follow and build upon the Levels of Configuration and employ `directives` to modify and create custom configurations, as they were introduced in Version [8.6.0](../getting-started/8.6.0_docs.md).
Themes follow and build upon the Levels of Configuration and employ `directives` to modify and create custom configurations, as they were introduced in Version [8.6.0](config/8.6.0_docs.md).
**These Theming Configurations, similar to directives, will also be made applicable in the Live-Editor, for easier styling.**

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Development and Contribution 🙌

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Overview for Beginners

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Adding a New Diagram/Chart 📊
@ -26,9 +30,8 @@ There are some jison specific sub steps here where the parser stores the data en
In the extract of the grammar above, it is defined that a call to the setTitle method in the data object will be done when parsing and the title keyword is encountered.
::: tip
Make sure that the `parseError` function for the parser is defined and calling `mermaid.parseError`. This way a common way of detecting parse errors is provided for the end-user.
:::
> Note
> Make sure that the `parseError` function for the parser is defined and calling `mermaid.parseError`. This way a common way of detecting parse errors is provided for the end-user.
For more info look in the example diagram type:

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Security

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Version 8.6.0 Changes
@ -48,9 +52,8 @@ Implementors can only modify configurations using directives, and cannot change
The Two types of directives: are `init` (or `initialize`) and `wrap`.
::: note
All directives are enclosed in `%%{ }%%`
:::
> Note
> All directives are enclosed in `%%{ }%%`
Older versions of mermaid will not parse directives because `%%` will comment out the directive. This makes the update backwards-compatible.
@ -62,8 +65,8 @@ Older versions of mermaid will not parse directives because `%%` will comment ou
| --------- | ----------------------- | --------- | -------- | ----------------------------------------------- |
| init | modifies configurations | Directive | Optional | Any parameters not included in the secure array |
::: note
init would be an argument-directive: `%%{init: { **insert argument here**}}%%`
> Note
> init would be an argument-directive: `%%{init: { **insert argument here**}}%%`
The json object that is passed as {**argument** } must be valid, quoted json or it will be ignored.
**for example**:
@ -73,7 +76,8 @@ The json object that is passed as {**argument** } must be valid, quoted json or
Configurations that are passed through init cannot change the parameters in a secure array at a higher level. In the event of a collision, mermaid will give priority to secure arrays and parse the request without changing the values of those parameters in conflict.
When deployed within code, init is called before the graph/diagram description.
:::
>
**for example**:
@ -107,15 +111,16 @@ When deployed within code, init is called before the graph/diagram description.
| --------- | ----------------------------- | --------- | -------- | ---------- |
| wrap | a callable text-wrap function | Directive | Optional | %%{wrap}%% |
::: note
Wrap is a function that is currently only deployable for sequence diagrams.
> Note
> Wrap is a function that is currently only deployable for sequence diagrams.
Wrap respects a manually added \<br>, so if the user wants to break up their text, they have full control over line breaks by adding \<br> tags.
It is a non-argument directive and can be executed thusly:
`%%{wrap}%%` .
:::
>
**An example of text wrapping in a sequence diagram**:
@ -157,13 +162,12 @@ Example of **object.Assign**:
| --------------- | ------------------------------------- | ----------- | --------------------------------------- | ---------- | ---------- |
| `setSiteConfig` | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array | conf | siteConfig |
::: note
Sets the siteConfig. The siteConfig is a protected configuration for repeat use. Calls to reset() will reset
the currentConfig to siteConfig. Calls to reset(configApi.defaultConfig) will reset siteConfig and currentConfig
to the defaultConfig
Note: currentConfig is set in this function。
Default value: will mirror Global Config
:::
> Note
> Sets the siteConfig. The siteConfig is a protected configuration for repeat use. Calls to reset() will reset
> the currentConfig to siteConfig. Calls to reset(configApi.defaultConfig) will reset siteConfig and currentConfig
> to the defaultConfig
> Note: currentConfig is set in this function。
> Default value: will mirror Global Config
## getSiteConfig
@ -171,9 +175,8 @@ Default value: will mirror Global Config
| --------------- | --------------------------------------------------- | ----------- | ---------------------------------- |
| `getSiteConfig` | Returns the current `siteConfig` base configuration | Get Request | Returns Any Values in `siteConfig` |
::: note
Returns any values in siteConfig.
:::
> Note
> Returns any values in siteConfig.
## setConfig
@ -181,11 +184,10 @@ Returns any values in siteConfig.
| ----------- | ------------------------------------------ | ----------- | --------------------------------- | ---------- | ---------------------------------------------- |
| `setConfig` | Sets the `currentConfig` to desired values | Put Request | Any Values, those in secure array | conf | `currentConfig` merged with the sanitized conf |
::: note
Sets the currentConfig. The parameter conf is sanitized based on the siteConfig.secure keys. Any
values found in conf with key found in siteConfig.secure will be replaced with the corresponding
siteConfig value.
:::
> Note
> Sets the currentConfig. The parameter conf is sanitized based on the siteConfig.secure keys. Any
> values found in conf with key found in siteConfig.secure will be replaced with the corresponding
> siteConfig value.
## getConfig
@ -193,9 +195,8 @@ siteConfig value.
| ----------- | --------------------------- | ----------- | ------------------------------- |
| `getConfig` | Obtains the `currentConfig` | Get Request | Any Values from `currentConfig` |
::: note
Returns any values in currentConfig.
:::
> Note
> Returns any values in currentConfig.
## sanitize
@ -203,10 +204,9 @@ Returns any values in currentConfig.
| ---------- | ---------------------------------------- | -------------- | ------ |
| `sanitize` | Sets the `siteConfig` to desired values. | Put Request(?) | None |
::: note
modifies options in-place
Ensures options parameter does not attempt to override siteConfig secure keys.
:::
> Note
> modifies options in-place
> Ensures options parameter does not attempt to override siteConfig secure keys.
## reset
@ -220,8 +220,8 @@ Ensures options parameter does not attempt to override siteConfig secure keys.
| --------- | ------------------------------------------------------------ | ---------- | -------- | -------------------------------------------- |
| `conf` | base set of values, which `currentConfig` could be reset to. | Dictionary | Required | Any Values, with respect to the secure Array |
::: note
default: current siteConfig (optional, default `getSiteConfig()`)
::: s
> Note
> default: current siteConfig (optional, default `getSiteConfig()`)
> s
## For more information, read [Setup](setup/README).

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Tutorials

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Accessibility Options

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Configuration

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Directives

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# mermaid CLI

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Advanced n00b mermaid (Coming soon..)

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# mermaid

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Module: config
@ -10,7 +14,7 @@
#### Defined in
[config.ts:7](https://github.com/emersonbottero/mermaid/blob/0da56a12/packages/mermaid/src/config.ts#L7)
[config.ts:7](https://github.com/emersonbottero/mermaid/blob/c8b377bf/packages/mermaid/src/config.ts#L7)
## Functions
@ -32,7 +36,7 @@ Pushes in a directive to the configuration
#### Defined in
[config.ts:191](https://github.com/emersonbottero/mermaid/blob/0da56a12/packages/mermaid/src/config.ts#L191)
[config.ts:191](https://github.com/emersonbottero/mermaid/blob/c8b377bf/packages/mermaid/src/config.ts#L191)
---
@ -56,7 +60,7 @@ Pushes in a directive to the configuration
#### Defined in
[config.ts:136](https://github.com/emersonbottero/mermaid/blob/0da56a12/packages/mermaid/src/config.ts#L136)
[config.ts:136](https://github.com/emersonbottero/mermaid/blob/c8b377bf/packages/mermaid/src/config.ts#L136)
---
@ -80,7 +84,7 @@ Pushes in a directive to the configuration
#### Defined in
[config.ts:96](https://github.com/emersonbottero/mermaid/blob/0da56a12/packages/mermaid/src/config.ts#L96)
[config.ts:96](https://github.com/emersonbottero/mermaid/blob/c8b377bf/packages/mermaid/src/config.ts#L96)
---
@ -114,7 +118,7 @@ Pushes in a directive to the configuration
#### Defined in
[config.ts:222](https://github.com/emersonbottero/mermaid/blob/0da56a12/packages/mermaid/src/config.ts#L222)
[config.ts:222](https://github.com/emersonbottero/mermaid/blob/c8b377bf/packages/mermaid/src/config.ts#L222)
---
@ -143,7 +147,7 @@ options in-place
#### Defined in
[config.ts:151](https://github.com/emersonbottero/mermaid/blob/0da56a12/packages/mermaid/src/config.ts#L151)
[config.ts:151](https://github.com/emersonbottero/mermaid/blob/c8b377bf/packages/mermaid/src/config.ts#L151)
---
@ -163,7 +167,7 @@ options in-place
#### Defined in
[config.ts:75](https://github.com/emersonbottero/mermaid/blob/0da56a12/packages/mermaid/src/config.ts#L75)
[config.ts:75](https://github.com/emersonbottero/mermaid/blob/c8b377bf/packages/mermaid/src/config.ts#L75)
---
@ -195,7 +199,7 @@ corresponding siteConfig value.
#### Defined in
[config.ts:113](https://github.com/emersonbottero/mermaid/blob/0da56a12/packages/mermaid/src/config.ts#L113)
[config.ts:113](https://github.com/emersonbottero/mermaid/blob/c8b377bf/packages/mermaid/src/config.ts#L113)
---
@ -228,7 +232,7 @@ function _Default value: At default, will mirror Global Config_
#### Defined in
[config.ts:61](https://github.com/emersonbottero/mermaid/blob/0da56a12/packages/mermaid/src/config.ts#L61)
[config.ts:61](https://github.com/emersonbottero/mermaid/blob/c8b377bf/packages/mermaid/src/config.ts#L61)
---
@ -249,7 +253,7 @@ function _Default value: At default, will mirror Global Config_
#### Defined in
[config.ts:14](https://github.com/emersonbottero/mermaid/blob/0da56a12/packages/mermaid/src/config.ts#L14)
[config.ts:14](https://github.com/emersonbottero/mermaid/blob/c8b377bf/packages/mermaid/src/config.ts#L14)
---
@ -269,4 +273,4 @@ function _Default value: At default, will mirror Global Config_
#### Defined in
[config.ts:79](https://github.com/emersonbottero/mermaid/blob/0da56a12/packages/mermaid/src/config.ts#L79)
[config.ts:79](https://github.com/emersonbottero/mermaid/blob/c8b377bf/packages/mermaid/src/config.ts#L79)

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Module: defaultConfig
@ -10,7 +14,7 @@
#### Defined in
[defaultConfig.ts:1855](https://github.com/emersonbottero/mermaid/blob/0da56a12/packages/mermaid/src/defaultConfig.ts#L1855)
[defaultConfig.ts:1855](https://github.com/emersonbottero/mermaid/blob/c8b377bf/packages/mermaid/src/defaultConfig.ts#L1855)
---
@ -52,4 +56,4 @@ Configuration
#### Defined in
[defaultConfig.ts:31](https://github.com/emersonbottero/mermaid/blob/0da56a12/packages/mermaid/src/defaultConfig.ts#L31)
[defaultConfig.ts:31](https://github.com/emersonbottero/mermaid/blob/c8b377bf/packages/mermaid/src/defaultConfig.ts#L31)

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Module: mermaidAPI
@ -16,7 +20,7 @@ Renames and re-exports [mermaidAPI](mermaidAPI.md#mermaidapi)
#### Defined in
[mermaidAPI.ts:483](https://github.com/emersonbottero/mermaid/blob/0da56a12/packages/mermaid/src/mermaidAPI.ts#L483)
[mermaidAPI.ts:483](https://github.com/emersonbottero/mermaid/blob/c8b377bf/packages/mermaid/src/mermaidAPI.ts#L483)
## Functions
@ -36,7 +40,7 @@ Renames and re-exports [mermaidAPI](mermaidAPI.md#mermaidapi)
#### Defined in
[mermaidAPI.ts:73](https://github.com/emersonbottero/mermaid/blob/0da56a12/packages/mermaid/src/mermaidAPI.ts#L73)
[mermaidAPI.ts:73](https://github.com/emersonbottero/mermaid/blob/c8b377bf/packages/mermaid/src/mermaidAPI.ts#L73)
---
@ -56,4 +60,4 @@ Renames and re-exports [mermaidAPI](mermaidAPI.md#mermaidapi)
#### Defined in
[mermaidAPI.ts:47](https://github.com/emersonbottero/mermaid/blob/0da56a12/packages/mermaid/src/mermaidAPI.ts#L47)
[mermaidAPI.ts:47](https://github.com/emersonbottero/mermaid/blob/c8b377bf/packages/mermaid/src/mermaidAPI.ts#L47)

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Theme Configuration
@ -152,9 +156,8 @@ You can create your own themes, by changing any of the given variables below. If
## Theme Variables Reference Table
::: note
Variables that are unique to some diagrams can be affected by changes in Theme Variables
:::
> Note
> Variables that are unique to some diagrams can be affected by changes in Theme Variables
| Variable | Default/Base/Factor value | Calc | Description |
| -------------------- | ------------------------------ | ---- | -------------------------------------------------------------------------------------------------------------------------------- |

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Usage
@ -115,10 +119,9 @@ Values:
- **antiscript**: html tags in text are allowed, (only script element is removed), click functionality is enabled
- **sandbox**: With this security level all rendering takes place in a sandboxed iframe. This prevent any JavaScript running in the context. This may hinder interactive functionality of the diagram like scripts, popups in sequence diagram or links to other tabs/targets etc.
::: note
This changes the default behaviour of mermaid so that after upgrade to 8.2, unless the `securityLevel` is not changed, tags in flowcharts are encoded as tags and clicking is disabled.
**sandbox** security level is still in the beta version.
:::
> Note
> This changes the default behaviour of mermaid so that after upgrade to 8.2, unless the `securityLevel` is not changed, tags in flowcharts are encoded as tags and clicking is disabled.
> **sandbox** security level is still in the beta version.
**If you are taking responsibility for the diagram source security you can set the `securityLevel` to a value of your choosing . This allows clicks and tags are allowed.**
@ -183,9 +186,8 @@ Or with no config object, and a jQuery selection:
mermaid.init(undefined, $('#someId .yetAnotherClass'));
```
::: warning
This type of integration is deprecated. Instead the preferred way of handling more complex integration is to use the mermaidAPI instead.
:::
> Warning
> This type of integration is deprecated. Instead the preferred way of handling more complex integration is to use the mermaidAPI instead.
## Usage with webpack
@ -339,9 +341,8 @@ on what kind of integration you use.
</script>
```
::: tip
This is the preferred way of configuring mermaid.
:::
> Note
> This is the preferred way of configuring mermaid.
### The following methods are deprecated and are kept only for backwards compatibility.
@ -357,9 +358,8 @@ approach are:
mermaid.startOnLoad = true;
```
::: warning
This way of setting the configuration is deprecated. Instead the preferred way is to use the initialize method. This functionality is only kept for backwards compatibility.
:::
> Warning
> This way of setting the configuration is deprecated. Instead the preferred way is to use the initialize method. This functionality is only kept for backwards compatibility.
## Using the mermaid_config
@ -373,9 +373,8 @@ approach are:
mermaid_config.startOnLoad = true;
```
::: warning
This way of setting the configuration is deprecated. Instead the preferred way is to use the initialize method. This functionality is only kept for backwards compatibility.
:::
> Warning
> This way of setting the configuration is deprecated. Instead the preferred way is to use the initialize method. This functionality is only kept for backwards compatibility.
## Using the mermaid.init call
@ -388,6 +387,5 @@ To set some configuration via the mermaid object. The two parameters that are su
mermaid_config.startOnLoad = true;
```
::: warning
This way of setting the configuration is deprecated. Instead the preferred way is to use the initialize method. This functionality is only kept for backwards compatibility.
:::
> Warning
> This way of setting the configuration is deprecated. Instead the preferred way is to use the initialize method. This functionality is only kept for backwards compatibility.

BIN
docs/img/er.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
---

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# About Mermaid
@ -205,7 +209,7 @@ erDiagram
```
### [User Journey Diagram](../syntax/user-journey.md)
### [User Journey Diagram](../syntax/userJourney.md)
```mermaid-example
journey

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# A Mermaid User-Guide for Beginners

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Diagram Syntax

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Frequently Asked Questions

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Integrations

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# C4 Diagrams

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Class diagrams

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Entity Relationship Diagrams

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Examples

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Flowcharts - Basic Syntax

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Gantt diagrams

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Gitgraph Diagrams

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Mindmap

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Pie chart diagrams

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Requirement Diagram

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# Sequence diagrams
@ -20,11 +24,12 @@ sequenceDiagram
Alice-)John: See you later!
```
::: note
A note on nodes, the word "end" could potentially break the diagram, due to the way that the mermaid language is scripted.
> Note
> A note on nodes, the word "end" could potentially break the diagram, due to the way that the mermaid language is scripted.
If unavoidable, one must use parentheses(), quotation marks "", or brackets {},\[], to enclose the word "end". i.e : (end), \[end], {end}.
:::
>
## Syntax

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# State diagrams

View File

@ -1,4 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in src/docs.
> **Warning**
>
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
>
> ## Please edit the corresponding file in package/mermaid/src/docs.
# User Journey Diagram

View File

@ -31,7 +31,7 @@
"build:esbuild": "concurrently \"pnpm build:code\" \"pnpm build:types\"",
"build": "pnpm clean; pnpm build:esbuild",
"dev": "node .esbuild/serve.cjs",
"predocs:build": "rimraf docs/.vitepress/dist",
"predocs:build": "rimraf docs",
"docs:build": "ts-node-esm src/docs.mts",
"docs:verify": "pnpm docs:build --verify",
"docs:code": "typedoc --plugin typedoc-plugin-markdown --readme none --hideBreadcrumbs --hideInPageTOC --namedAnchors --out src/docs/config/setup --entryPointStrategy expand src/defaultConfig.ts src/config.ts src/mermaidAPI.ts",

View File

@ -50,7 +50,9 @@ const MERMAID_MAJOR_VERSION = (
const SOURCE_DOCS_DIR = 'src/docs';
const FINAL_DOCS_DIR = '../../docs';
const AUTOGENERATED_TEXT = `# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit the corresponding file in ${SOURCE_DOCS_DIR}.`;
const AUTOGENERATED_TEXT = `> **Warning**
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
> ## Please edit the corresponding file in package/mermaid/src/docs.`;
const LOGMSG_TRANSFORMED = 'transformed';
const LOGMSG_TO_BE_TRANSFORMED = 'to be transformed';
@ -131,6 +133,41 @@ const copyTransformedContents = (filename: string, doCopy = false, transformedCo
logWasOrShouldBeTransformed(fileInFinalDocDir, doCopy);
};
const transformAnnotation = (content: string, type: 'warning' | 'tip' | 'note') => {
let transformed = content;
let regex = /::: note\n[\s\S]+?:::/gm;
let text = 'Note';
switch (type) {
case 'note':
regex = /::: note\s?\n[\s\S]+?:::/gm;
break;
case 'tip':
regex = /::: tip\s?\n[\s\S]+?:::/gm;
text = 'Note';
break;
case 'warning':
regex = /::: warning\s?\n[\s\S]+?:::/gm;
text = 'Warning';
break;
default:
break;
}
const matches = content.match(regex);
if (matches) {
console.log(`found ${matches.length} of ${type}`);
const formatted = matches.map((element) =>
element.replace(`::: ${type}`, `> ${text}`).replace(':::', '>').replace('\n', '\n> ')
);
let n = 0;
for (const match of matches) {
transformed = transformed.replace(match, formatted[n++]);
}
}
return transformed;
};
const readSyncedUTF8file = (filename: string): string => {
return readFileSync(filename, 'utf8');
};
@ -148,7 +185,12 @@ const readSyncedUTF8file = (filename: string): string => {
* @param file {string} name of the file that will be verified
*/
const transformMarkdown = (file: string) => {
const doc = readSyncedUTF8file(file).replace(/<MERMAID_VERSION>/g, MERMAID_MAJOR_VERSION);
let doc = readSyncedUTF8file(file).replace(/<MERMAID_VERSION>/g, MERMAID_MAJOR_VERSION);
doc = transformAnnotation(doc, 'warning');
doc = transformAnnotation(doc, 'tip');
doc = transformAnnotation(doc, 'note');
const ast: Root = remark.parse(doc);
const out = flatmap(ast, (c: Code) => {
if (c.type !== 'code') {