Skip to content

Commit eec97d1

Browse files
committed
#3192 Adding the ability to create invisible links in flowcharts(v2)
1 parent 551b37f commit eec97d1

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

packages/mermaid/src/dagre-wrapper/edges.js

+3
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,9 @@ export const insertEdge = function (elem, e, edge, clusterDb, diagramType, graph
438438
case 'thick':
439439
strokeClasses = 'edge-thickness-thick';
440440
break;
441+
case 'invisible':
442+
strokeClasses = 'edge-thickness-thick';
443+
break;
441444
default:
442445
strokeClasses = '';
443446
}

packages/mermaid/src/diagrams/flowchart/flowDb.js

+4
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,10 @@ const destructEndLink = (_str) => {
674674
stroke = 'thick';
675675
}
676676

677+
if (line[0] === '~') {
678+
stroke = 'invisible';
679+
}
680+
677681
let dots = countChar('.', line);
678682

679683
if (dots) {

packages/mermaid/src/diagrams/flowchart/flowRenderer-v2.js

+5
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ export const addEdges = function (edges, g, diagObj) {
280280
edgeData.pattern = 'solid';
281281
edgeData.style = 'stroke-width: 3.5px;fill:none;';
282282
break;
283+
case 'invisible':
284+
edgeData.thickness = 'invisible';
285+
edgeData.pattern = 'solid';
286+
edgeData.style = 'stroke-width: 0;fill:none;';
287+
break;
283288
}
284289
if (typeof edge.style !== 'undefined') {
285290
const styles = getStylesFromArray(edge.style);

packages/mermaid/src/diagrams/flowchart/parser/flow.jison

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ that id.
120120
\s*[xo<]?\-\-+[-xo>]\s* return 'LINK';
121121
\s*[xo<]?\=\=+[=xo>]\s* return 'LINK';
122122
\s*[xo<]?\-?\.+\-[xo>]?\s* return 'LINK';
123+
\s*\~\~[\~]+\s* return 'LINK';
123124
\s*[xo<]?\-\-\s* return 'START_LINK';
124125
\s*[xo<]?\=\=\s* return 'START_LINK';
125126
\s*[xo<]?\-\.\s* return 'START_LINK';

0 commit comments

Comments
 (0)