chore: Prettier

This commit is contained in:
Sidharth Vinod 2024-03-23 11:39:02 +05:30
parent 3278899787
commit 16f1dccd22
No known key found for this signature in database
GPG Key ID: FB5CCD378D3907CD
76 changed files with 508 additions and 366 deletions

View File

@ -3,5 +3,6 @@
"printWidth": 100,
"singleQuote": true,
"useTabs": false,
"tabWidth": 2
"tabWidth": 2,
"trailingComma": "es5"
}

View File

@ -810,7 +810,10 @@ context('Sequence diagram', () => {
note left of Alice: config: mirrorActors=true<br/>directive: mirrorActors=false
Bob->>Alice: Short as well
`,
{ logLevel: 0, sequence: { mirrorActors: true, noteFontSize: 18, noteFontFamily: 'Arial' } }
{
logLevel: 0,
sequence: { mirrorActors: true, noteFontSize: 18, noteFontFamily: 'Arial' },
}
);
});
});
@ -861,7 +864,10 @@ context('Sequence diagram', () => {
a->>j: Hello John, how are you?
j-->>a: Great!
`,
{ logLevel: 0, sequence: { mirrorActors: true, noteFontSize: 18, noteFontFamily: 'Arial' } }
{
logLevel: 0,
sequence: { mirrorActors: true, noteFontSize: 18, noteFontFamily: 'Arial' },
}
);
});
it('should support actor links and properties when not mirrored EXPERIMENTAL: USE WITH CAUTION', () => {

View File

@ -33,7 +33,9 @@
background-image: radial-gradient(#fff 1%, transparent 11%),
radial-gradient(#fff 1%, transparent 11%);
background-size: 20px 20px;
background-position: 0 0, 10px 10px;
background-position:
0 0,
10px 10px;
background-repeat: repeat;
}
.malware {

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />

View File

@ -175,13 +175,15 @@ statement
The functions for setting title and description are provided by a common module. This is the import from flowDb.js:
import {
```
import {
setAccTitle,
getAccTitle,
getAccDescription,
setAccDescription,
clear as commonClear,
} from '../../commonDb';
} from '../../commonDb';
```
The accessibility title and description are inserted into the SVG element in the `render` function in mermaidAPI.

View File

@ -64,13 +64,15 @@ The syntax for accessible titles and descriptions is described in [the Accessibi
The functions for setting title and description are provided by a common module. This is the import in flowDb.js:
import {
```
import {
setAccTitle,
getAccTitle,
getAccDescription,
setAccDescription,
clear as commonClear,
} from '../../commonDb';
} from '../../commonDb';
```
The accessibility title and description are inserted into the SVG element in the `render` function in mermaidAPI.

View File

@ -47,7 +47,8 @@ Here the structure of a directive text is like a nested key-value pair map or a
The following code snippet shows the structure of a directive:
%%{
```
%%{
init: {
"theme": "dark",
"fontFamily": "monospace",
@ -60,15 +61,20 @@ The following code snippet shows the structure of a directive:
"mirrorActors": true
}
}
}%%
}%%
```
You can also define the directives in a single line, like this:
%%{init: { **insert configuration options here** } }%%
```
%%{init: { **insert configuration options here** } }%%
```
For example, the following code snippet:
%%{init: { "sequence": { "mirrorActors":false }}}%%
```
%%{init: { "sequence": { "mirrorActors":false }}}%%
```
**Notes:**
The JSON object that is passed as {**argument**} must be valid key value pairs and encased in quotation marks or it will be ignored.

View File

@ -61,7 +61,7 @@ By default, MathML is used for rendering mathematical expressions. If you have u
Example with legacy mode enabled (the latest version of KaTeX's stylesheet can be found on their [docs](https://katex.org/docs/browser.html)):
```html
<!DOCTYPE html>
<!doctype html>
<!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
<html lang="en">
<head>

View File

@ -73,7 +73,7 @@ Example:
## Simple full example:
```html
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<body>
<pre class="mermaid">

View File

@ -311,7 +311,9 @@ xychart-beta
### CDN
https://cdn.jsdelivr.net/npm/mermaid@<version>/dist/
```
https://cdn.jsdelivr.net/npm/mermaid@<version>/dist/
```
To select a version:

View File

@ -51,7 +51,7 @@ One should **beware the use of some words or symbols** that can break diagrams.
| Diagram Breakers | Reason | Solution |
| ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------- | ------------------------------------------------- |
| **Comments** | | |
| [` %%{``}%% `](https://github.com/mermaid-js/mermaid/issues/1968) | Similar to [Directives](../config/directives.md) confuses the renderer. | In comments using `%%`, avoid using "{}". |
| [`%%{``}%%`](https://github.com/mermaid-js/mermaid/issues/1968) | Similar to [Directives](../config/directives.md) confuses the renderer. | In comments using `%%`, avoid using "{}". |
| **Flow-Charts** | | |
| 'end' | The word "End" can cause Flowcharts and Sequence diagrams to break | Wrap them in quotation marks to prevent breakage. |
| [Nodes inside Nodes](../syntax/flowchart.md?id=special-characters-that-break-syntax) | Mermaid gets confused with nested shapes | wrap them in quotation marks to prevent breaking |

View File

@ -636,8 +636,10 @@ Understanding and avoiding common syntax errors is key to a smooth experience wi
A common mistake is incorrect linking syntax, which can lead to unexpected results or broken diagrams:
block-beta
```
block-beta
A - B
```
**Correction**:
Ensure that links between blocks are correctly specified with arrows (--> or ---) to define the direction and type of connection. Also remember that one of the fundaments for block diagram is to give the author full control of where the boxes are positioned so in the example you need to add a space between the boxes:

View File

@ -8,7 +8,7 @@
> "In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of static structure diagram that describes the structure of a system by showing the system's classes, their attributes, operations (or methods), and the relationships among objects."
>
> \-Wikipedia
> -Wikipedia
The class diagram is the main building block of object-oriented modeling. It is used for general conceptual modeling of the structure of the application, and for detailed modeling to translate the models into programming code. Class diagrams can also be used for data modeling. The classes in a class diagram represent both the main elements, interactions in the application, and the classes to be programmed.
@ -296,7 +296,9 @@ To describe the visibility (or encapsulation) of an attribute or method/function
A relationship is a general term covering the specific types of logical connections found on class and object diagrams.
[classA][Arrow][ClassB]
```
[classA][Arrow][ClassB]
```
There are eight different types of relations defined for classes under UML which are currently supported:
@ -369,7 +371,9 @@ classO .. classP : Link(Dashed)
It is possible to add label text to a relation:
[classA][Arrow][ClassB]:LabelText
```
[classA][Arrow][ClassB]:LabelText
```
```mermaid-example
classDiagram
@ -401,7 +405,9 @@ classDiagram
Here is the syntax:
[Relation Type][Link][Relation Type]
```
[Relation Type][Link][Relation Type]
```
Where `Relation Type` can be one of:
@ -465,7 +471,9 @@ The different cardinality options are :
Cardinality can be easily defined by placing the text option within quotes `"` before or after a given arrow. For example:
[classA] "cardinality1" [Arrow] "cardinality2" [ClassB]:LabelText
```
[classA] "cardinality1" [Arrow] "cardinality2" [ClassB]:LabelText
```
```mermaid-example
classDiagram
@ -618,9 +626,11 @@ It is possible to bind a click event to a node. The click can lead to either a j
You would define these actions on a separate line after all classes have been declared.
action className "reference" "tooltip"
click className call callback() "tooltip"
click className href "url" "tooltip"
```
action className "reference" "tooltip"
click className call callback() "tooltip"
click className href "url" "tooltip"
```
- _action_ is either `link` or `callback`, depending on which type of interaction you want to have called
- _className_ is the id of the node that the action will be associated with
@ -803,11 +813,15 @@ should have a different look. This is done by predefining classes in css styles
Then attaching that class to a specific node:
```
cssClass "nodeId1" styleClass;
```
It is also possible to attach a class to a list of nodes in one statement:
```
cssClass "nodeId1,nodeId2" styleClass;
```
A shorter form of adding a class is to attach the classname to the node using the `:::` operator:

View File

@ -86,7 +86,9 @@ When including attributes on ER diagrams, you must decide whether to include for
Mermaid syntax for ER diagrams is compatible with PlantUML, with an extension to label the relationship. Each statement consists of the following parts:
```
<first-entity> [<relationship> <second-entity> : <relationship-label>]
```
Where:
@ -97,7 +99,9 @@ Where:
For example:
```
PROPERTY ||--|{ ROOM : contains
```
This statement can be read as _a property contains one or more rooms, and a room is part of one and only one property_. You can see that the label here is from the first entity's perspective: a property contains a room, but a room does not contain a property. When considered from the perspective of the second entity, the equivalent label is usually very easy to infer. (Some ER diagrams label relationships from both perspectives, but this is not supported here, and is usually superfluous).

View File

@ -642,9 +642,11 @@ Numbers given are base 10, so `#` can be encoded as `#35;`. It is also supported
## Subgraphs
subgraph title
```
subgraph title
graph definition
end
end
```
An example below:
@ -857,8 +859,10 @@ It is possible to bind a click event to a node, the click can lead to either a j
> **Note**
> This functionality is disabled when using `securityLevel='strict'` and enabled when using `securityLevel='loose'`.
click nodeId callback
click nodeId call callback()
```
click nodeId callback
click nodeId call callback()
```
- nodeId is the id of the node
- callback is the name of a javascript function defined on the page displaying the graph, the function will be called with the nodeId as parameter.
@ -981,11 +985,15 @@ have no ids in the same way as nodes, some other way of deciding what style the
Instead of ids, the order number of when the link was defined in the graph is used, or use default to apply to all links.
In the example below the style defined in the linkStyle statement will belong to the fourth link in the graph:
linkStyle 3 stroke:#ff3,stroke-width:4px,color:red;
```
linkStyle 3 stroke:#ff3,stroke-width:4px,color:red;
```
It is also possible to add style to multiple links in a single statement, by separating link numbers with commas:
linkStyle 1,2,7 color:blue;
```
linkStyle 1,2,7 color:blue;
```
### Styling line curves
@ -995,8 +1003,10 @@ Available curve styles include `basis`, `bumpX`, `bumpY`, `cardinal`, `catmullRo
In this example, a left-to-right graph uses the `stepBefore` curve style:
%%{ init: { 'flowchart': { 'curve': 'stepBefore' } } }%%
graph LR
```
%%{ init: { 'flowchart': { 'curve': 'stepBefore' } } }%%
graph LR
```
For a full list of available curves, including an explanation of custom curves, refer to
the [Shapes](https://github.com/d3/d3-shape/blob/main/README.md#curves) documentation in the
@ -1027,19 +1037,27 @@ should have a different look.
A class definition looks like the example below:
```
classDef className fill:#f9f,stroke:#333,stroke-width:4px;
```
Also, it is possible to define style to multiple classes in one statement:
```
classDef firstClassName,secondClassName font-size:12pt;
```
Attachment of a class to a node is done as per below:
```
class nodeId1 className;
```
It is also possible to attach a class to a list of nodes in one statement:
```
class nodeId1,nodeId2 className;
```
A shorter form of adding a class is to attach the classname to the node using the `:::`operator as per below:
@ -1110,7 +1128,9 @@ flowchart LR
If a class is named default it will be assigned to all classes without specific class definitions.
```
classDef default fill:#f9f,stroke:#333,stroke-width:4px;
```
## Basic support for fontawesome
@ -1183,7 +1203,9 @@ Starting with Mermaid version 9.4, you can use an alternate renderer named elk.
The _elk_ renderer is an experimental feature.
You can change the renderer to elk by adding this directive:
%%{init: {"flowchart": {"defaultRenderer": "elk"}} }%%
```
%%{init: {"flowchart": {"defaultRenderer": "elk"}} }%%
```
> **Note**
> Note that the site needs to use mermaid version 9.4+ for this to work and have this featured enabled in the lazy-loading configuration.

View File

@ -468,11 +468,15 @@ Styling of the Gantt diagram is done by defining a number of CSS classes. During
You can style or hide the marker for the current date. To style it, add a value for the `todayMarker` key.
todayMarker stroke-width:5px,stroke:#0f0,opacity:0.5
```
todayMarker stroke-width:5px,stroke:#0f0,opacity:0.5
```
To hide the marker, set `todayMarker` to `off`.
todayMarker off
```
todayMarker off
```
## Configuration
@ -514,8 +518,10 @@ mermaid.ganttConfig = {
It is possible to bind a click event to a task. The click can lead to either a javascript callback or to a link which will be opened in the current browser tab. **Note**: This functionality is disabled when using `securityLevel='strict'` and enabled when using `securityLevel='loose'`.
click taskId call callback(arguments)
click taskId href URL
```
click taskId call callback(arguments)
click taskId href URL
```
- taskId is the id of the task
- callback is the name of a javascript function defined on the page displaying the graph, the function will be called with the taskId as the parameter if no other arguments are specified.

View File

@ -60,11 +60,13 @@ The syntax for creating Mindmaps is simple and relies on indentation for setting
In the following example you can see how there are 3 different levels. One with starting at the left of the text and another level with two rows starting at the same column, defining the node A. At the end there is one more level where the text is indented further than the previous lines defining the nodes B and C.
mindmap
```
mindmap
Root
A
B
C
```
In summary is a simple text outline where there is one node at the root level called `Root` which has one child `A`. `A` in turn has two children `B`and `C`. In the diagram below we can see this rendered as a mindmap.
@ -230,11 +232,13 @@ _These classes need to be supplied by the site administrator._
The actual indentation does not really matter only compared with the previous rows. If we take the previous example and disrupt it a little we can see how the calculations are performed. Let us start with placing C with a smaller indentation than `B` but larger then `A`.
mindmap
```
mindmap
Root
A
B
C
```
This outline is unclear as `B` clearly is a child of `A` but when we move on to `C` the clarity is lost. `C` is not a child of `B` with a higher indentation nor does it have the same indentation as `B`. The only thing that is clear is that the first node with smaller indentation, indicating a parent, is A. Then Mermaid relies on this known truth and compensates for the unclear indentation and selects `A` as a parent of `C` leading till the same diagram with `B` and `C` as siblings.

View File

@ -7,7 +7,7 @@
# Pie chart diagrams
> A pie chart (or a circle chart) is a circular statistical graphic, which is divided into slices to illustrate numerical proportion. In a pie chart, the arc length of each slice (and consequently its central angle and area), is proportional to the quantity it represents. While it is named for its resemblance to a pie which has been sliced, there are variations on the way it can be presented. The earliest known pie chart is generally credited to William Playfair's Statistical Breviary of 1801
> \-Wikipedia
> -Wikipedia
Mermaid can render Pie Chart diagrams.

View File

@ -59,8 +59,10 @@ The title is a short description of the chart and it will always render on top o
#### Example
quadrantChart
```
quadrantChart
title This is a sample example
```
### x-axis

View File

@ -56,12 +56,14 @@ An important note on user text: all input can be surrounded in quotes or not. Fo
A requirement definition contains a requirement type, name, id, text, risk, and verification method. The syntax follows:
<type> user_defined_name {
```
<type> user_defined_name {
id: user_defined_id
text: user_defined text
risk: <risk>
verifymethod: <method>
}
}
```
Type, risk, and method are enumerations defined in SysML.
@ -75,10 +77,12 @@ Type, risk, and method are enumerations defined in SysML.
An element definition contains an element name, type, and document reference. These three are all user defined. The element feature is intended to be lightweight but allow requirements to be connected to portions of other documents.
element user_defined_name {
```
element user_defined_name {
type: user_defined_type
docref: user_defined_ref
}
}
```
### Relationship
@ -86,11 +90,15 @@ Relationships are comprised of a source node, destination node, and relationship
Each follows the definition format of
{name of source} - <type> -> {name of destination}
```
{name of source} - <type> -> {name of destination}
```
or
{name of destination} <- <type> - {name of source}
```
{name of destination} <- <type> - {name of source}
```
"name of source" and "name of destination" should be names of requirement or element nodes defined elsewhere.

View File

@ -98,8 +98,10 @@ sequenceDiagram
It is possible to create and destroy actors by messages. To do so, add a create or destroy directive before the message.
create participant B
A --> B: Hello
```
create participant B
A --> B: Hello
```
Create directives support actor/participant distinction and aliases. The sender or the recipient of a message can be destroyed but only the recipient can be created.
@ -143,22 +145,26 @@ And fixing diagram code does not get rid of this error and rendering of all othe
The actor(s) can be grouped in vertical boxes. You can define a color (if not, it will be transparent) and/or a descriptive label using the following notation:
box Aqua Group Description
... actors ...
end
box Group without description
... actors ...
end
box rgb(33,66,99)
... actors ...
end
```
box Aqua Group Description
... actors ...
end
box Group without description
... actors ...
end
box rgb(33,66,99)
... actors ...
end
```
> **Note**
> If your group name is a color you can force the color to be transparent:
box transparent Aqua
... actors ...
end
```
box transparent Aqua
... actors ...
end
```
```mermaid-example
sequenceDiagram
@ -196,7 +202,9 @@ The actor(s) can be grouped in vertical boxes. You can define a color (if not, i
Messages can be of two displayed either solid or with a dotted line.
[Actor][Arrow][Actor]:Message text
```
[Actor][Arrow][Actor]:Message text
```
There are six types of arrows currently supported:
@ -314,9 +322,11 @@ sequenceDiagram
It is possible to express loops in a sequence diagram. This is done by the notation
loop Loop text
... statements ...
end
```
loop Loop text
... statements ...
end
```
See the example below:
@ -340,17 +350,21 @@ sequenceDiagram
It is possible to express alternative paths in a sequence diagram. This is done by the notation
alt Describing text
... statements ...
else
... statements ...
end
```
alt Describing text
... statements ...
else
... statements ...
end
```
or if there is sequence that is optional (if without else).
opt Describing text
... statements ...
end
```
opt Describing text
... statements ...
end
```
See the example below:
@ -386,13 +400,15 @@ It is possible to show actions that are happening in parallel.
This is done by the notation
par [Action 1]
... statements ...
and [Action 2]
... statements ...
and [Action N]
... statements ...
end
```
par [Action 1]
... statements ...
and [Action 2]
... statements ...
and [Action N]
... statements ...
end
```
See the example below:
@ -454,13 +470,15 @@ It is possible to show actions that must happen automatically with conditional h
This is done by the notation
critical [Action that must be performed]
... statements ...
option [Circumstance A]
... statements ...
option [Circumstance B]
... statements ...
end
```
critical [Action that must be performed]
... statements ...
option [Circumstance A]
... statements ...
option [Circumstance B]
... statements ...
end
```
See the example below:
@ -510,9 +528,11 @@ It is possible to indicate a stop of the sequence within the flow (usually used
This is done by the notation
break [something happened]
... statements ...
end
```
break [something happened]
... statements ...
end
```
See the example below:
@ -542,15 +562,17 @@ It is possible to highlight flows by providing colored background rects. This is
The colors are defined using rgb and rgba syntax.
rect rgb(0, 255, 0)
... content ...
end
```
rect rgb(0, 255, 0)
... content ...
end
```
<!---->
rect rgba(0, 0, 255, .1)
... content ...
end
```
rect rgba(0, 0, 255, .1)
... content ...
end
```
See the examples below:
@ -674,7 +696,9 @@ Actors can have popup-menus containing individualized links to external pages. F
This can be configured by adding one or more link lines with the format:
link <actor>: <link-label> @ <link-url>
```
link <actor>: <link-label> @ <link-url>
```
```mermaid-example
sequenceDiagram
@ -708,7 +732,9 @@ There is an advanced syntax that relies on JSON formatting. If you are comfortab
This can be configured by adding the links lines with the format:
links <actor>: <json-formatted link-name link-url pairs>
```
links <actor>: <json-formatted link-name link-url pairs>
```
An example is below:

View File

@ -467,7 +467,9 @@ a _[valid CSS property name](https://www.w3.org/TR/CSS/#properties)_ followed by
Here is an example of a classDef with just one property-value pair:
```
classDef movement font-style:italic;
```
where
@ -478,7 +480,9 @@ If you want to have more than one _property-value pair_ then you put a comma (`,
Here is an example with three property-value pairs:
```
classDef badBadEvent fill:#f00,color:white,font-weight:bold,stroke-width:2px,stroke:yellow
```
where

View File

@ -39,8 +39,10 @@ xychart-beta
The chart can be drawn horizontal or vertical, default value is vertical.
xychart-beta horizontal
...
```
xychart-beta horizontal
...
```
### Title
@ -48,9 +50,11 @@ The title is a short description of the chart and it will always render on top o
#### Example
xychart-beta
```
xychart-beta
title "This is a simple example"
...
```
> **Note**
> If the title is a single word one no need to use `"`, but if it has space `"` is needed
@ -96,8 +100,10 @@ A bar chart offers the capability to graphically depict bars.
The only two things required are the chart name (`xychart-beta`) and one data set. So you will be able to draw a chart with a simple config like
xychart-beta
```
xychart-beta
line [+1.3, .6, 2.4, -.34]
```
## Chart Configurations

View File

@ -423,13 +423,15 @@ It is possible to indicate a stop of the sequence within the flow (usually used
This is done by the notation
try {
```
try {
...statements...
} catch {
} catch {
...statements...
} finally {
} finally {
...statements...
}
}
```
See the example below:

View File

@ -85,7 +85,7 @@ const LOGMSG_COPIED = `, and copied to ${FINAL_DOCS_DIR}`;
const WARN_DOCSDIR_DOESNT_MATCH = `Changed files were transformed in ${SOURCE_DOCS_DIR} but do not match the files in ${FINAL_DOCS_DIR}. Please run 'pnpm --filter mermaid run docs:build' after making changes to ${SOURCE_DOCS_DIR} to update the ${FINAL_DOCS_DIR} directory with the transformed files.`;
const prettierConfig = prettier.resolveConfig.sync('.') ?? {};
const prettierConfig = (await prettier.resolveConfig('.')) ?? {};
// From https://github.com/vuejs/vitepress/blob/428eec3750d6b5648a77ac52d88128df0554d4d1/src/node/markdownToVue.ts#L20-L21
const includesRE = /<!--\s*@include:\s*(.*?)\s*-->/g;
const includedFiles: Set<string> = new Set();
@ -326,7 +326,7 @@ export function transformMarkdownAst({
*
* @param file {string} name of the file that will be verified
*/
const transformMarkdown = (file: string) => {
const transformMarkdown = async (file: string) => {
const doc = injectPlaceholders(transformIncludeStatements(file, readSyncedUTF8file(file)));
let transformed = remark()
@ -347,7 +347,7 @@ const transformMarkdown = (file: string) => {
transformed = doc;
}
const formatted = prettier.format(transformed, {
const formatted = await prettier.format(transformed, {
parser: 'markdown',
...prettierConfig,
});
@ -454,7 +454,7 @@ async function transformJsonSchema(file: string) {
const transformed = transformer.stringify(await transformer.run(markdownAst as Root));
const formatted = prettier.format(transformed, {
const formatted = await prettier.format(transformed, {
parser: 'markdown',
...prettierConfig,
});
@ -472,7 +472,7 @@ async function transformJsonSchema(file: string) {
*
* @param filename {string} name of the HTML file to transform
*/
const transformHtml = (filename: string) => {
const transformHtml = async (filename: string) => {
/**
* Insert the '...auto generated...' comment into an HTML file after the<html> element
*
@ -496,7 +496,7 @@ const transformHtml = (filename: string) => {
};
const transformedHTML = insertAutoGeneratedComment(filename);
const formattedHTML = prettier.format(transformedHTML, {
const formattedHTML = await prettier.format(transformedHTML, {
parser: 'html',
...prettierConfig,
});
@ -541,7 +541,7 @@ export const processDocs = async () => {
const mdFileGlobs = getGlobs([posix.join(sourceDirGlob, '*.md')]);
const mdFiles = await getFilesFromGlobs(mdFileGlobs);
console.log(`${action} ${mdFiles.length} markdown files...`);
mdFiles.forEach(transformMarkdown);
await Promise.all(mdFiles.map(transformMarkdown));
for (const includedFile of includedFiles) {
rmSync(includedFile, { force: true });
@ -552,7 +552,7 @@ export const processDocs = async () => {
const htmlFileGlobs = getGlobs([posix.join(sourceDirGlob, '*.html')]);
const htmlFiles = await getFilesFromGlobs(htmlFileGlobs);
console.log(`${action} ${htmlFiles.length} html files...`);
htmlFiles.forEach(transformHtml);
await Promise.all(htmlFiles.map(transformHtml));
const otherFileGlobs = getGlobs([sourceDirGlob, '!**/*.md', '!**/*.html']);
const otherFiles = await getFilesFromGlobs(otherFileGlobs);
@ -591,9 +591,9 @@ export const processDocs = async () => {
return;
}
if (isMd(path)) {
transformMarkdown(path);
void transformMarkdown(path);
} else if (isHtml(path)) {
transformHtml(path);
void transformHtml(path);
} else if (isOther(path)) {
copyTransformedContents(path, true);
}

View File

@ -67,9 +67,8 @@ describe('the flowchart renderer', function () {
});
});
['Multi<br>Line', 'Multi<br/>Line', 'Multi<br />Line', 'Multi<br\t/>Line'].forEach(function (
labelText
) {
['Multi<br>Line', 'Multi<br/>Line', 'Multi<br />Line', 'Multi<br\t/>Line'].forEach(
function (labelText) {
it('should handle multiline texts with different line breaks', async function () {
const addedNodes = [];
const fakeDiag = {
@ -109,7 +108,8 @@ describe('the flowchart renderer', function () {
expect(addedNodes[0][1].label.firstChild.innerHTML).toEqual('Multi'); // <tspan> node, line 1
expect(addedNodes[0][1].label.lastChild.innerHTML).toEqual('Line'); // <tspan> node, line 2
});
});
}
);
[
[['fill:#fff'], 'fill:#fff;', ''],

View File

@ -98,7 +98,10 @@ describe('Testing quadrantChart jison file', () => {
str =
'quadrantChart\n Y-AxIs "Urgent(* +=[❤" --> "Not Urgent (* +=[❤"\n ';
expect(parserFnConstructor(str)).not.toThrow();
expect(mockDB.setYAxisBottomText).toHaveBeenCalledWith({ text: 'Urgent(* +=[❤', type: 'text' });
expect(mockDB.setYAxisBottomText).toHaveBeenCalledWith({
text: 'Urgent(* +=[❤',
type: 'text',
});
expect(mockDB.setYAxisTopText).toHaveBeenCalledWith({
text: 'Not Urgent (* +=[❤',
type: 'text',
@ -107,7 +110,10 @@ describe('Testing quadrantChart jison file', () => {
clearMocks();
str = 'quadrantChart\n y-AxIs "Urgent(* +=[❤"';
expect(parserFnConstructor(str)).not.toThrow();
expect(mockDB.setYAxisBottomText).toHaveBeenCalledWith({ text: 'Urgent(* +=[❤', type: 'text' });
expect(mockDB.setYAxisBottomText).toHaveBeenCalledWith({
text: 'Urgent(* +=[❤',
type: 'text',
});
expect(mockDB.setYAxisTopText).not.toHaveBeenCalled();
clearMocks();
@ -165,7 +171,10 @@ describe('Testing quadrantChart jison file', () => {
clearMocks();
str = 'QuadRantChart \n QuaDrant-3 "Deligate(* +=[❤"';
expect(parserFnConstructor(str)).not.toThrow();
expect(mockDB.setQuadrant3Text).toHaveBeenCalledWith({ text: 'Deligate(* +=[❤', type: 'text' });
expect(mockDB.setQuadrant3Text).toHaveBeenCalledWith({
text: 'Deligate(* +=[❤',
type: 'text',
});
});
it('should be able to parse quadrant4 text', () => {

View File

@ -25,7 +25,11 @@ const clear = (): void => {
};
class SankeyLink {
constructor(public source: SankeyNode, public target: SankeyNode, public value: number = 0) {}
constructor(
public source: SankeyNode,
public target: SankeyNode,
public value: number = 0
) {}
}
/**

View File

@ -627,12 +627,18 @@ const activationBounds = function (actor, actors) {
const actorObj = actors[actor];
const activations = actorActivations(actor);
const left = activations.reduce(function (acc, activation) {
const left = activations.reduce(
function (acc, activation) {
return common.getMin(acc, activation.startx);
}, actorObj.x + actorObj.width / 2 - 1);
const right = activations.reduce(function (acc, activation) {
},
actorObj.x + actorObj.width / 2 - 1
);
const right = activations.reduce(
function (acc, activation) {
return common.getMax(acc, activation.stopx);
}, actorObj.x + actorObj.width / 2 + 1);
},
actorObj.x + actorObj.width / 2 + 1
);
return [left, right];
};

View File

@ -37,7 +37,7 @@ By default, MathML is used for rendering mathematical expressions. If you have u
Example with legacy mode enabled (the latest version of KaTeX's stylesheet can be found on their [docs](https://katex.org/docs/browser.html)):
```html
<!DOCTYPE html>
<!doctype html>
<!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
<html lang="en">
<head>

View File

@ -67,7 +67,7 @@ Example:
## Simple full example:
```html
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<body>
<pre class="mermaid">

View File

@ -33,7 +33,7 @@ One should **beware the use of some words or symbols** that can break diagrams.
| Diagram Breakers | Reason | Solution |
| ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------- | ------------------------------------------------- |
| **Comments** | | |
| [` %%{``}%% `](https://github.com/mermaid-js/mermaid/issues/1968) | Similar to [Directives](../config/directives.md) confuses the renderer. | In comments using `%%`, avoid using "{}". |
| [`%%{``}%%`](https://github.com/mermaid-js/mermaid/issues/1968) | Similar to [Directives](../config/directives.md) confuses the renderer. | In comments using `%%`, avoid using "{}". |
| **Flow-Charts** | | |
| 'end' | The word "End" can cause Flowcharts and Sequence diagrams to break | Wrap them in quotation marks to prevent breakage. |
| [Nodes inside Nodes](../syntax/flowchart.md?id=special-characters-that-break-syntax) | Mermaid gets confused with nested shapes | wrap them in quotation marks to prevent breaking |

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />

View File

@ -39,9 +39,11 @@ export class MockedD3 {
return this.select(select_str);
});
append = vi
.fn()
.mockImplementation(function (this: MockedD3, type: string, id = '' + '-appended'): MockedD3 {
append = vi.fn().mockImplementation(function (
this: MockedD3,
type: string,
id = '' + '-appended'
): MockedD3 {
const newMock = new MockedD3(id);
newMock.attribs.set('type', type);
this._children.push(newMock);

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />