diff --git a/cypress/integration/rendering/flowchart.spec.js b/cypress/integration/rendering/flowchart.spec.js index c88129ddc..4acccfc37 100644 --- a/cypress/integration/rendering/flowchart.spec.js +++ b/cypress/integration/rendering/flowchart.spec.js @@ -640,4 +640,35 @@ describe('Flowchart', () => { { flowchart: { htmlLabels: false } } ); }); + + it('31: should not slice off edges that are to the left of the left-most vertex', () => { + imgSnapshotTest( + `graph TD + work --> sleep + sleep --> work + eat --> sleep + work --> eat + `, + { flowchart: { htmlLabels: false } } + ); + }); + + it('32: Render Subroutine shape', () => { + imgSnapshotTest( + `graph LR + A[[subroutine shape test]] + A -->|Get money| B[[Go shopping]] + B --> C[[Let me think...
Do I want something for work,
something to spend every free second with,
or something to get around?]] + C -->|One| D[[Laptop]] + C -->|Two| E[[iPhone]] + C -->|Three| F[[Car
wroom wroom]] + click A "index.html#link-clicked" "link test" + click B testClick "click test" + classDef someclass fill:#f96; + class A someclass; + class C someclass; + `, + { flowchart: { htmlLabels: false } } + ); + }); }); diff --git a/cypress/integration/rendering/gantt.spec.js b/cypress/integration/rendering/gantt.spec.js index c3614ec19..4c90654c8 100644 --- a/cypress/integration/rendering/gantt.spec.js +++ b/cypress/integration/rendering/gantt.spec.js @@ -1,7 +1,7 @@ /* eslint-env jest */ import { imgSnapshotTest } from '../../helpers/util.js'; -describe('Sequencediagram', () => { +describe('Gantt diagram', () => { it('should render a gantt chart', () => { imgSnapshotTest( ` @@ -130,4 +130,34 @@ describe('Sequencediagram', () => { {} ); }); + + it('should hide today marker', () => { + imgSnapshotTest( + ` + gantt + title Hide today marker (vertical line should not be visible) + dateFormat YYYY-MM-DD + axisFormat %d + todayMarker off + section Section1 + Today: 1, -1h + `, + {} + ); + }); + + it('should style today marker', () => { + imgSnapshotTest( + ` + gantt + title Style today marker (vertical line should be 5px wide and half-transparent blue) + dateFormat YYYY-MM-DD + axisFormat %d + todayMarker stroke-width:5px,stroke:#00f,opacity:0.5 + section Section1 + Today: 1, -1h + `, + {} + ); + }); }); diff --git a/cypress/integration/rendering/sequencediagram.spec.js b/cypress/integration/rendering/sequencediagram.spec.js index c084b73c1..cf65485c7 100644 --- a/cypress/integration/rendering/sequencediagram.spec.js +++ b/cypress/integration/rendering/sequencediagram.spec.js @@ -182,5 +182,18 @@ context('Sequence diagram', () => { {} ); }); + it('should render autonumber with different line breaks', () => { + imgSnapshotTest( + ` + sequenceDiagram + autonumber + Alice->>John: Hello John,
how are you? + Alice->>John: John,
can you hear me? + John-->>Alice: Hi Alice,
I can hear you! + John-->>Alice: I feel great! + `, + {} + ); + }); }); }); diff --git a/dist/index.html b/dist/index.html index 46af0d709..f33151662 100644 --- a/dist/index.html +++ b/dist/index.html @@ -16,6 +16,9 @@
info
+ +
+
gantt title Exclusive end dates (Manual date should end on 3d) @@ -25,7 +28,6 @@ 2 Days: 1, 2019-01-01,2d Manual Date: 2, 2019-01-01,2019-01-03
-
gantt title Inclusive end dates (Manual date should end on 4th) @@ -36,6 +38,27 @@ 2 Days: 1, 2019-01-01,2d Manual Date: 2, 2019-01-01,2019-01-03
+
+ gantt + title Hide today marker (vertical line should not be visible) + dateFormat YYYY-MM-DD + axisFormat %d + todayMarker off + section Section1 + Today: 1, -1h +
+
+ gantt + title Style today marker (vertical line should be 5px wide and half-transparent blue) + dateFormat YYYY-MM-DD + axisFormat %d + todayMarker stroke-width:5px,stroke:#00f,opacity:0.5 + section Section1 + Today: 1, -1h +
+ +
+
graph LR sid-B3655226-6C29-4D00-B685-3D5C734DC7E1[" @@ -315,6 +338,20 @@ graph TB class A someclass; class C someclass;
+
+ graph LR + A[[subroutine shape test]] + A -->|Get money| B[[Go shopping]] + B --> C[[Let me think...
Do I want something for work,
something to spend every free second with,
or something to get around?]] + C -->|One| D[[Laptop]] + C -->|Two| E[[iPhone]] + C -->|Three| F[[Car
wroom wroom]] + click A "index.html#link-clicked" "link test" + click B testClick "click test" + classDef someclass fill:#f96; + class A someclass; + class C someclass; +
graph LR A[(cylindrical
shape
test)] @@ -441,6 +478,14 @@ end 4->>1: multiline
using #lt;br /#gt; note right of 1: multiline
using #lt;br /#gt;
+
+ sequenceDiagram + autonumber + Alice->>John: Hello John,
how are you? + Alice->>John: John,
can you hear me? + John-->>Alice: Hi Alice,
I can hear you! + John-->>Alice: I feel great! +

diff --git a/docs/entityRelationshipDiagram.md b/docs/entityRelationshipDiagram.md index da5bf4b0d..8a3924d3b 100644 --- a/docs/entityRelationshipDiagram.md +++ b/docs/entityRelationshipDiagram.md @@ -2,7 +2,7 @@ > An entity–relationship model (or ER model) describes interrelated things of interest in a specific domain of knowledge. A basic ER model is composed of entity types (which classify the things of interest) and specifies relationships that can exist between entities (instances of those entity types). Wikipedia. -Note that practitioners of ER modelling almost always refer to entity types simply as entities. For example the CUSTOMER entity type would be referred to simply as the CUSTOMER entity. This is so common it would be inadvisable to do anything else, but technically an entity is an abstract *instance* of an entity type, and this is what an ER diagram shows - abstract instances, and the relationships between them. This is why entities are always named using singular nouns. +Note that practitioners of ER modelling almost always refer to *entity types* simply as *entities*. For example the CUSTOMER entity type would be referred to simply as the CUSTOMER entity. This is so common it would be inadvisable to do anything else, but technically an entity is an abstract *instance* of an entity type, and this is what an ER diagram shows - abstract instances, and the relationships between them. This is why entities are always named using singular nouns. Mermaid can render ER diagrams ``` @@ -24,7 +24,7 @@ Relationships between entities are represented by lines with end markers represe ## Status -ER diagrams are a new feature in Mermaid and are **experimental**. There are likely to be a few bugs and constraints, and enhancements will be made in due course. +ER diagrams are a new feature in Mermaid and are **experimental**. There are likely to be a few bugs and constraints, and enhancements will be made in due course. Currently you can only define entities and relationships, but not attributes. ## Syntax @@ -61,10 +61,10 @@ Cardinality is a property that describes how many elements of another entity can | Value (left) | Value (right) | Meaning | |:------------:|:-------------:|--------------------------------------------------------| -| `|o` | `o|` | Zero or one | -| `||` | `||` | Exactly one | +| `\|o` | `o\|` | Zero or one | +| `\|\|` | `\|\|` | Exactly one | | `}o` | `o{` | Zero or more (no upper limit) | -| `}|` | `|{` | One or more (no upper limit) | +| `}\|` | `\|{` | One or more (no upper limit) | ### Identification diff --git a/docs/flowchart.md b/docs/flowchart.md index 0d964bdcc..1e3d00510 100644 --- a/docs/flowchart.md +++ b/docs/flowchart.md @@ -89,6 +89,17 @@ graph LR id1([This is the text in the box]) ``` +### A node in a subroutine shape + +``` +graph LR + id1[[This is the text in the box]] +``` +```mermaid +graph LR + id1[[This is the text in the box]] +``` + ### A node in a cylindrical shape ``` diff --git a/docs/index.html b/docs/index.html index 376fd5d66..c3bdbb17b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -7,7 +7,7 @@ - +