mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-12-24 13:16:39 +01:00
Compare commits
3 Commits
dev-tool
...
fix-flowch
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2774269cf | ||
|
|
015af7603e | ||
|
|
c810fab231 |
5
.changeset/eager-pigs-help.md
Normal file
5
.changeset/eager-pigs-help.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'mermaid': patch
|
||||
---
|
||||
|
||||
fix: Handle backslash parsing in math formulas within new flowchart shape syntax
|
||||
@@ -144,6 +144,18 @@ describe('when parsing directions', function () {
|
||||
expect(data4Layout.nodes[0].shape).toEqual('rounded');
|
||||
expect(data4Layout.nodes[0].label).toEqual('DD');
|
||||
});
|
||||
it('should handle mathematical formulas with backslashes in quoted strings', function () {
|
||||
/* eslint-disable no-useless-escape */
|
||||
const res = flow.parser.parse(`flowchart RL
|
||||
H@{ shape: rect, label: "$$\sin x$$"}`);
|
||||
/* eslint-enable no-useless-escape */
|
||||
|
||||
const data4Layout = flow.parser.yy.getData();
|
||||
|
||||
expect(data4Layout.nodes.length).toBe(1);
|
||||
expect(data4Layout.nodes[0].shape).toEqual('rect');
|
||||
expect(data4Layout.nodes[0].label).toEqual('$$sin x$$');
|
||||
});
|
||||
it('should be possible to link to a node with more data', function () {
|
||||
const res = flow.parser.parse(`flowchart TB
|
||||
A --> D@{
|
||||
|
||||
@@ -53,6 +53,7 @@ accDescr\s*"{"\s* { this.begin("acc_descr_multilin
|
||||
// console.log('shapeData', yytext);
|
||||
const re = /\n\s*/g;
|
||||
yytext = yytext.replace(re,"<br/>");
|
||||
yytext = yytext.replace(/\\/g, "\\\\");
|
||||
return 'SHAPE_DATA'}
|
||||
<shapeData>[^}^"]+ {
|
||||
// console.log('shapeData', yytext);
|
||||
|
||||
Reference in New Issue
Block a user