mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-23 17:29:54 +02:00
Removing requirement to add ids for nodes with a shape
This commit is contained in:
@@ -33,7 +33,6 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.mermaid {
|
.mermaid {
|
||||||
|
|
||||||
}
|
}
|
||||||
.mermaid svg {
|
.mermaid svg {
|
||||||
border: 1px solid purple;
|
border: 1px solid purple;
|
||||||
@@ -45,8 +44,8 @@
|
|||||||
<body>
|
<body>
|
||||||
<pre class="mermaid" style="width: 50%">
|
<pre class="mermaid" style="width: 50%">
|
||||||
mindmap
|
mindmap
|
||||||
apa
|
[apa]
|
||||||
bapa
|
))bapa((
|
||||||
</pre>
|
</pre>
|
||||||
<pre class="mermaid2" style="width: 50%">
|
<pre class="mermaid2" style="width: 50%">
|
||||||
flowchart TD
|
flowchart TD
|
||||||
@@ -62,21 +61,14 @@ flowchart TD
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
</div>
|
</pre>
|
||||||
<div class="mermaid2" style="width: 50%;">
|
|
||||||
flowchart TD
|
<pre class="mermaid2" style="width: 50%">
|
||||||
id
|
|
||||||
</div>
|
|
||||||
<pre class="mermaid2" style="width: 50%;">
|
|
||||||
flowchart LR
|
flowchart LR
|
||||||
a["<strong>Haiya</strong>"]===>b
|
a["<strong>Haiya</strong>"]===>b
|
||||||
</pre>
|
</pre
|
||||||
<div class="mermaid2" style="width: 50%;">
|
>
|
||||||
flowchart TD
|
<div class="mermaid2" style="width: 50%">flowchart TD A --> B A --> C B --> C</div>
|
||||||
A --> B
|
|
||||||
A --> C
|
|
||||||
B --> C
|
|
||||||
</pre>
|
|
||||||
<pre class="mermaid2" style="width: 50%">
|
<pre class="mermaid2" style="width: 50%">
|
||||||
flowchart TD
|
flowchart TD
|
||||||
A([stadium shape test])
|
A([stadium shape test])
|
||||||
@@ -90,17 +82,12 @@ flowchart TD
|
|||||||
classDef someclass fill:#f96;
|
classDef someclass fill:#f96;
|
||||||
class A someclass;
|
class A someclass;
|
||||||
class C someclass;
|
class C someclass;
|
||||||
</div>
|
|
||||||
<div class="mermaid2" style="width: 50%;">
|
|
||||||
sequenceDiagram
|
|
||||||
title: My Sequence Diagram Title
|
|
||||||
accTitle: My Acc Sequence Diagram
|
|
||||||
accDescr: My Sequence Diagram Description
|
|
||||||
|
|
||||||
Alice->>John: Hello John, how are you?
|
|
||||||
John-->>Alice: Great!
|
|
||||||
Alice-)John: See you later!
|
|
||||||
</pre>
|
</pre>
|
||||||
|
<div class="mermaid2" style="width: 50%">
|
||||||
|
sequenceDiagram title: My Sequence Diagram Title accTitle: My Acc Sequence Diagram accDescr:
|
||||||
|
My Sequence Diagram Description Alice->>John: Hello John, how are you? John-->>Alice: Great!
|
||||||
|
Alice-)John: See you later!
|
||||||
|
</div>
|
||||||
<pre class="mermaid2" style="width: 50%">
|
<pre class="mermaid2" style="width: 50%">
|
||||||
graph TD
|
graph TD
|
||||||
A -->|000| B
|
A -->|000| B
|
||||||
|
@@ -30,7 +30,17 @@ describe('when parsing a mindmap ', function () {
|
|||||||
expect(mm.children[0].descr).toEqual('child1');
|
expect(mm.children[0].descr).toEqual('child1');
|
||||||
expect(mm.children[1].descr).toEqual('child2');
|
expect(mm.children[1].descr).toEqual('child2');
|
||||||
});
|
});
|
||||||
it('should handle a hierachial mindmap definition', function () {
|
|
||||||
|
it('should handle a simple root definition with a shape and without an id abc123', function () {
|
||||||
|
var str = `mindmap
|
||||||
|
(root)`;
|
||||||
|
|
||||||
|
mindmap.parse(str);
|
||||||
|
// console.log('Time for checks', mindmap.yy.getMindmap().descr);
|
||||||
|
expect(mindmap.yy.getMindmap().descr).toEqual('root');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle a deeper hierachial mindmap definition', function () {
|
||||||
var str = `mindmap
|
var str = `mindmap
|
||||||
root
|
root
|
||||||
child1
|
child1
|
||||||
@@ -131,7 +141,7 @@ root
|
|||||||
|
|
||||||
it('mutiple types (cloud)', function () {
|
it('mutiple types (cloud)', function () {
|
||||||
var str = `mindmap
|
var str = `mindmap
|
||||||
root))the root((
|
root)the root(
|
||||||
`;
|
`;
|
||||||
|
|
||||||
mindmap.parse(str);
|
mindmap.parse(str);
|
||||||
@@ -256,7 +266,7 @@ root
|
|||||||
expect(child.children[1].nodeId).toEqual('b');
|
expect(child.children[1].nodeId).toEqual('b');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('should be possible to have meaningless empty rows in a mindmap abc123', function () {
|
it('should be possible to have meaningless empty rows in a mindmap abc124', function () {
|
||||||
var str = `mindmap
|
var str = `mindmap
|
||||||
root(Root)
|
root(Root)
|
||||||
Child(Child)
|
Child(Child)
|
||||||
|
@@ -86,6 +86,16 @@ statement
|
|||||||
| EOF
|
| EOF
|
||||||
;
|
;
|
||||||
node
|
node
|
||||||
|
:nodeWithId
|
||||||
|
|nodeWithoutId
|
||||||
|
;
|
||||||
|
|
||||||
|
nodeWithoutId
|
||||||
|
: NODE_DSTART NODE_DESCR NODE_DEND
|
||||||
|
{ console.log("node found ..", $1); $$ = { id: $2, descr: $2, type: yy.getType($1, $3) }; }
|
||||||
|
;
|
||||||
|
|
||||||
|
nodeWithId
|
||||||
: NODE_ID { $$ = { id: $1, descr: $1, type: yy.nodeType.DEFAULT }; }
|
: NODE_ID { $$ = { id: $1, descr: $1, type: yy.nodeType.DEFAULT }; }
|
||||||
| NODE_ID NODE_DSTART NODE_DESCR NODE_DEND
|
| NODE_ID NODE_DSTART NODE_DESCR NODE_DEND
|
||||||
{ console.log("node found ..", $1); $$ = { id: $1, descr: $3, type: yy.getType($2, $4) }; }
|
{ console.log("node found ..", $1); $$ = { id: $1, descr: $3, type: yy.getType($2, $4) }; }
|
||||||
|
Reference in New Issue
Block a user