Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions packages/mermaid/src/diagrams/sankey/parser/sankey.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,35 @@ describe('Sankey diagram', function () {
`)
);
});

it('handles special characters in node names with sankey-beta syntax', function () {
// Test for issue #7528: Sankey Diagram Parsing Failure with Special Characters
sankey.parser.parse(
prepareTextForParsing(`sankey-beta
Agricultural 'waste',Bio-conversion,124.729
Electricity grid,Lighting & appliances,90.008
Electricity grid,Over generation / exports,104.453
District heating,Heating and cooling - homes,22.505
`)
);
const graph = sankey.parser.yy.getGraph();
expect(graph.nodes).toHaveLength(7);
expect(graph.links).toHaveLength(4);
});

it('handles special characters in node names with sankey syntax', function () {
// Test for issue #7528: Sankey Diagram Parsing Failure with Special Characters
sankey.parser.parse(
prepareTextForParsing(`sankey
Agricultural 'waste',Bio-conversion,124.729
Electricity grid,Lighting & appliances,90.008
Electricity grid,Over generation / exports,104.453
District heating,Heating and cooling - homes,22.505
`)
);
const graph = sankey.parser.yy.getGraph();
expect(graph.nodes).toHaveLength(7);
expect(graph.links).toHaveLength(4);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const extension = (elem, type, id) => {
.attr('class', 'marker extension ' + type)
.attr('refX', 18)
.attr('refY', 7)
.attr('markerWidth', 190)
.attr('markerHeight', 240)
.attr('markerWidth', 20)
.attr('markerHeight', 28)
.attr('orient', 'auto')
.attr('markerUnits', 'userSpaceOnUse')
.append('path')
Expand Down
Loading