Skip to content

Commit

Permalink
Merge pull request #3493 from sidharthv96/sidv/testDocLint
Browse files Browse the repository at this point in the history
Fix CI `docs:lint`
  • Loading branch information
knsv committed Sep 21, 2022
2 parents f69ead5 + b9cb7e9 commit 01ca1cc
Show file tree
Hide file tree
Showing 13 changed files with 306 additions and 62 deletions.
14 changes: 13 additions & 1 deletion docs/8.6.0_docs.md
Expand Up @@ -77,7 +77,19 @@ When deployed within code, init is called before the graph/diagram description.

**for example**:

```mmd
```mermaid-example
%%{init: {"theme": "default", "logLevel": 1 }}%%
graph LR
a-->b
b-->c
c-->d
d-->e
e-->f
f-->g
g-->
```

```mermaid
%%{init: {"theme": "default", "logLevel": 1 }}%%
graph LR
a-->b
Expand Down
28 changes: 26 additions & 2 deletions docs/CHANGELOG.md
Expand Up @@ -42,7 +42,13 @@ It is also possible to override site-wide theme settings locally, for a specific

**Following is an example:**

```mmd
```mermaid-example
%%{init: {'theme':'base'}}%%
graph TD
a --> b
```

```mermaid
%%{init: {'theme':'base'}}%%
graph TD
a --> b
Expand All @@ -58,7 +64,25 @@ The easiest way to make a custom theme is to start with the base theme, and just

Here is an example of overriding `primaryColor` and giving everything a different look, using `%%init%%`.

```mmd
```mermaid-example
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ff0000'}}}%%
graph TD
A[Christmas] -->|Get money| B(Go shopping)
B --> C{Let me think}
B --> G[/Another/]
C ==>|One| D[Laptop]
C -->|Two| E[iPhone]
C -->|Three| F[fa:fa-car Car]
subgraph section
C
D
E
F
G
end
```

```mermaid
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ff0000'}}}%%
graph TD
A[Christmas] -->|Get money| B(Go shopping)
Expand Down
84 changes: 78 additions & 6 deletions docs/README.md
Expand Up @@ -49,7 +49,15 @@ In our release process we rely heavily on visual regression tests using [applito

### [Flowchart](./flowchart.md?id=flowcharts-basic-syntax)

```mmd
```mermaid-example
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
```

```mermaid
graph TD;
A-->B;
A-->C;
Expand All @@ -61,7 +69,21 @@ graph TD;

### [Sequence diagram](./sequenceDiagram.md)

```mmd
```mermaid-example
sequenceDiagram
participant Alice
participant Bob
Alice->>John: Hello John, how are you?
loop Healthcheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts <br/>prevail!
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!
```

```mermaid
sequenceDiagram
participant Alice
participant Bob
Expand All @@ -79,7 +101,20 @@ sequenceDiagram

### [Gantt diagram](./gantt.md)

```mmd
```mermaid-example
gantt
dateFormat YYYY-MM-DD
title Adding GANTT diagram to mermaid
excludes weekdays 2014-01-10
section A section
Completed task :done, des1, 2014-01-06,2014-01-08
Active task :active, des2, 2014-01-09, 3d
Future task : des3, after des2, 5d
Future task2 : des4, after des3, 5d
```

```mermaid
gantt
dateFormat YYYY-MM-DD
title Adding GANTT diagram to mermaid
Expand All @@ -96,7 +131,24 @@ Future task2 : des4, after des3, 5d

### [Class diagram](./classDiagram.md)

```mmd
```mermaid-example
classDiagram
Class01 <|-- AveryLongClass : Cool
Class03 *-- Class04
Class05 o-- Class06
Class07 .. Class08
Class09 --> C2 : Where am i?
Class09 --* C3
Class09 --|> Class07
Class07 : equals()
Class07 : Object[] elementData
Class01 : size()
Class01 : int chimp
Class01 : int gorilla
Class08 <--> C2: Cool label
```

```mermaid
classDiagram
Class01 <|-- AveryLongClass : Cool
Class03 *-- Class04
Expand Down Expand Up @@ -145,7 +197,15 @@ Class08 <--> C2: Cool label

### [Entity Relationship Diagram - :exclamation: experimental](./entityRelationshipDiagram.md)

```mmd
```mermaid-example
erDiagram
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ LINE-ITEM : contains
CUSTOMER }|..|{ DELIVERY-ADDRESS : uses
```

```mermaid
erDiagram
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ LINE-ITEM : contains
Expand All @@ -157,7 +217,19 @@ erDiagram

### [User Journey Diagram](./user-journey.md)

```mmd
```mermaid-example
journey
title My working day
section Go to work
Make tea: 5: Me
Go upstairs: 3: Me
Do work: 1: Me, Cat
section Go home
Go downstairs: 5: Me
Sit down: 5: Me
```

```mermaid
journey
title My working day
section Go to work
Expand Down
39 changes: 35 additions & 4 deletions docs/classDiagram.md
Expand Up @@ -336,7 +336,12 @@ classE o-- classF : aggregation

Relations can logically represent an N:M association:

```mmd
```mermaid-example
classDiagram
Animal <|--|> Zebra
```

```mermaid
classDiagram
Animal <|--|> Zebra
```
Expand Down Expand Up @@ -468,7 +473,17 @@ class Color{

Comments can be entered within a class diagram, which will be ignored by the parser. Comments need to be on their own line, and must be prefaced with `%%` (double percent signs). Any text until the next newline will be treated as a comment, including any class diagram syntax.

```mmd
```mermaid-example
classDiagram
%% This whole line is a comment classDiagram class Shape <<interface>>
class Shape{
<<interface>>
noOfVertices
draw()
}
```

```mermaid
classDiagram
%% This whole line is a comment classDiagram class Shape <<interface>>
class Shape{
Expand Down Expand Up @@ -538,7 +553,15 @@ You would define these actions on a separate line after all classes have been de

_URL Link:_

```mmd
```mermaid-example
classDiagram
class Shape
link Shape "https://www.github.com" "This is a tooltip for a link"
class Shape2
click Shape2 href "https://www.github.com" "This is a tooltip for a link"
```

```mermaid
classDiagram
class Shape
link Shape "https://www.github.com" "This is a tooltip for a link"
Expand All @@ -548,7 +571,15 @@ click Shape2 href "https://www.github.com" "This is a tooltip for a link"

_Callback:_

```mmd
```mermaid-example
classDiagram
class Shape
callback Shape "callbackFunction" "This is a tooltip for a callback"
class Shape2
click Shape2 call callbackFunction() "This is a tooltip for a callback"
```

```mermaid
classDiagram
class Shape
callback Shape "callbackFunction" "This is a tooltip for a callback"
Expand Down
18 changes: 16 additions & 2 deletions docs/diagrams-and-syntax-and-examples/flowchart.md
Expand Up @@ -397,7 +397,15 @@ graph TB

If you describe the same diagram using the the basic syntax, it will take four lines:

```mmd
```mermaid-example
graph TB
A --> C
A --> D
B --> C
B --> D
```

```mermaid
graph TB
A --> C
A --> D
Expand Down Expand Up @@ -740,7 +748,13 @@ Beginner's tip—here's a full example of using interactive links in HTML:

Comments can be entered within a flow diagram, which will be ignored by the parser. Comments need to be on their own line, and must be prefaced with `%%` (double percent signs). Any text until the next newline will be treated as a comment, including all punctuation and any flow syntax.

```mmd
```mermaid-example
graph LR
%% this is a comment A -- text --> B{node}
A -- text --> B -- text2 --> C
```

```mermaid
graph LR
%% this is a comment A -- text --> B{node}
A -- text --> B -- text2 --> C
Expand Down
8 changes: 7 additions & 1 deletion docs/entityRelationshipDiagram.md
Expand Up @@ -114,7 +114,13 @@ Cardinality is a property that describes how many elements of another entity can

Relationships may be classified as either _identifying_ or _non-identifying_ and these are rendered with either solid or dashed lines respectively. This is relevant when one of the entities in question can not have independent existence without the other. For example a firm that insures people to drive cars might need to store data on `NAMED-DRIVER`s. In modelling this we might start out by observing that a `CAR` can be driven by many `PERSON` instances, and a `PERSON` can drive many `CAR`s - both entities can exist without the other, so this is a non-identifying relationship that we might specify in Mermaid as: `PERSON }|..|{ CAR : "driver"`. Note the two dots in the middle of the relationship that will result in a dashed line being drawn between the two entities. But when this many-to-many relationship is resolved into two one-to-many relationships, we observe that a `NAMED-DRIVER` cannot exist without both a `PERSON` and a `CAR` - the relationships become identifying and would be specified using hyphens, which translate to a solid line:

```mmd
```mermaid-example
erDiagram
CAR ||--o{ NAMED-DRIVER : allows
PERSON ||--o{ NAMED-DRIVER : is
```

```mermaid
erDiagram
CAR ||--o{ NAMED-DRIVER : allows
PERSON ||--o{ NAMED-DRIVER : is
Expand Down
18 changes: 16 additions & 2 deletions docs/flowchart.md
Expand Up @@ -403,7 +403,15 @@ word of warning, one could go overboard with this making the flowchart harder to
markdown form. The Swedish word `lagom` comes to mind. It means, not too much and not too little.
This goes for expressive syntaxes as well.

```mmd
```mermaid-example
flowchart TB
A --> C
A --> D
B --> C
B --> D
```

```mermaid
flowchart TB
A --> C
A --> D
Expand Down Expand Up @@ -778,7 +786,13 @@ Beginner's tip—a full example using interactive links in a html context:

Comments can be entered within a flow diagram, which will be ignored by the parser. Comments need to be on their own line, and must be prefaced with `%%` (double percent signs). Any text after the start of the comment to the next newline will be treated as a comment, including any flow syntax

```mmd
```mermaid-example
flowchart LR
%% this is a comment A -- text --> B{node}
A -- text --> B -- text2 --> C
```

```mermaid
flowchart LR
%% this is a comment A -- text --> B{node}
A -- text --> B -- text2 --> C
Expand Down
16 changes: 15 additions & 1 deletion docs/gantt.md
Expand Up @@ -234,7 +234,21 @@ More info in: https://github.com/mbostock/d3/wiki/Time-Formatting

Comments can be entered within a gantt chart, which will be ignored by the parser. Comments need to be on their own line and must be prefaced with `%%` (double percent signs). Any text after the start of the comment to the next newline will be treated as a comment, including any diagram syntax

```mmd
```mermaid-example
gantt
title A Gantt Diagram
%% this is a comment
dateFormat YYYY-MM-DD
section Section
A task :a1, 2014-01-01, 30d
Another task :after a1 , 20d
section Another
Task in sec :2014-01-12 , 12d
another task : 24d
```

```mermaid
gantt
title A Gantt Diagram
%% this is a comment
Expand Down
24 changes: 22 additions & 2 deletions docs/sequenceDiagram.md
Expand Up @@ -481,7 +481,14 @@ sequenceDiagram

Comments can be entered within a sequence diagram, which will be ignored by the parser. Comments need to be on their own line, and must be prefaced with `%%` (double percent signs). Any text after the start of the comment to the next newline will be treated as a comment, including any diagram syntax

```mmd
```mermaid-example
sequenceDiagram
Alice->>John: Hello John, how are you?
%% this is a comment
John-->>Alice: Great!
```

```mermaid
sequenceDiagram
Alice->>John: Hello John, how are you?
%% this is a comment
Expand Down Expand Up @@ -554,7 +561,20 @@ This can be configured by adding one or more link lines with the format:

link <actor>: <link-label> @ <link-url>

```mmd
```mermaid-example
sequenceDiagram
participant Alice
participant John
link Alice: Dashboard @ https://dashboard.contoso.com/alice
link Alice: Wiki @ https://wiki.contoso.com/alice
link John: Dashboard @ https://dashboard.contoso.com/john
link John: Wiki @ https://wiki.contoso.com/john
Alice->>John: Hello John, how are you?
John-->>Alice: Great!
Alice-)John: See you later!
```

```mermaid
sequenceDiagram
participant Alice
participant John
Expand Down

0 comments on commit 01ca1cc

Please sign in to comment.