diff --git a/cypress/integration/rendering/flowchart.spec.js b/cypress/integration/rendering/flowchart.spec.js index 1ae10aba9..e4766e792 100644 --- a/cypress/integration/rendering/flowchart.spec.js +++ b/cypress/integration/rendering/flowchart.spec.js @@ -901,13 +901,8 @@ graph TD { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' } ); }); - it('67: allow escaping quotes with backslash', () => { - imgSnapshotTest(` - graph TD - a_node("This has an escaped \\" in it") -- "edge string can escape too \\"" --> b_node - `); - }); - it('68: should be able to style default node independently', () => { + + it('67: should be able to style default node independently', () => { imgSnapshotTest( ` flowchart TD diff --git a/docs/syntax/flowchart.md b/docs/syntax/flowchart.md index 5a338c261..fb0b7f2e3 100644 --- a/docs/syntax/flowchart.md +++ b/docs/syntax/flowchart.md @@ -610,13 +610,11 @@ For quotation marks, you can escape them with a backslash as well. ```mermaid-example flowchart LR A["A double quote:#quot;"] --> B["A dec char:#9829;"] - B --> C["This is a \"square\" vertex"] ``` ```mermaid flowchart LR A["A double quote:#quot;"] --> B["A dec char:#9829;"] - B --> C["This is a \"square\" vertex"] ``` Numbers given are base 10, so `#` can be encoded as `#35;`. It is also supported to use HTML character names. diff --git a/packages/mermaid/src/diagrams/flowchart/flowDb.js b/packages/mermaid/src/diagrams/flowchart/flowDb.js index 33ae68a86..32ffb3df0 100644 --- a/packages/mermaid/src/diagrams/flowchart/flowDb.js +++ b/packages/mermaid/src/diagrams/flowchart/flowDb.js @@ -91,7 +91,6 @@ export const addVertex = function (_id, textObj, type, style, classes, dir, prop if (textObj !== undefined) { config = configApi.getConfig(); txt = sanitizeText(textObj.text.trim()); - txt = textObj.type === 'string' ? txt.replaceAll('\\"', '"') : txt; vertices[id].labelType = textObj.type; // strip quotes if string starts and ends with a quote if (txt[0] === '"' && txt[txt.length - 1] === '"') { diff --git a/packages/mermaid/src/diagrams/flowchart/parser/flow-text.spec.js b/packages/mermaid/src/diagrams/flowchart/parser/flow-text.spec.js index 3dfde5ccb..b127e1b65 100644 --- a/packages/mermaid/src/diagrams/flowchart/parser/flow-text.spec.js +++ b/packages/mermaid/src/diagrams/flowchart/parser/flow-text.spec.js @@ -598,13 +598,6 @@ describe('[Text] when parsing', () => { expect(() => flow.parser.parse(str)).toThrowError("Expecting 'SQE'"); }); - it('should parse escaped quotes in a string state', function () { - //prettier-ignore - flow.parser.parse('graph TD; A["This is a \\"()\\" in text"];'); //eslint-disable-line no-useless-escape - const vert = flow.parser.yy.getVertices(); - expect(vert['A'].text).toBe('This is a "()" in text'); - }); - it('should throw error', function () { const str = `graph TD; node[hello ) world] --> works`; expect(() => flow.parser.parse(str)).toThrowError("got 'PE'"); diff --git a/packages/mermaid/src/diagrams/flowchart/parser/flow.jison b/packages/mermaid/src/diagrams/flowchart/parser/flow.jison index a4584c808..8268722f3 100644 --- a/packages/mermaid/src/diagrams/flowchart/parser/flow.jison +++ b/packages/mermaid/src/diagrams/flowchart/parser/flow.jison @@ -60,8 +60,8 @@ Function arguments are optional: 'call ()' simply executes 'callba [^`"]+ { return "MD_STR";} [`]["] { this.popState();} -<*>["][`] { this.begin("md_string");} -(\\(?=\")\"|[^"])+ return "STR"; +<*>["][`] { this.begin("md_string");} +[^"]+ return "STR"; ["] this.popState(); <*>["] this.pushState("string"); "style" return 'STYLE'; diff --git a/packages/mermaid/src/docs/syntax/flowchart.md b/packages/mermaid/src/docs/syntax/flowchart.md index b5308ad50..960bf9755 100644 --- a/packages/mermaid/src/docs/syntax/flowchart.md +++ b/packages/mermaid/src/docs/syntax/flowchart.md @@ -392,7 +392,6 @@ For quotation marks, you can escape them with a backslash as well. ```mermaid-example flowchart LR A["A double quote:#quot;"] --> B["A dec char:#9829;"] - B --> C["This is a \"square\" vertex"] ``` Numbers given are base 10, so `#` can be encoded as `#35;`. It is also supported to use HTML character names.