From f5445b266e7523c10ceca517d0cda6667ca2cf8a Mon Sep 17 00:00:00 2001 From: darshanr0107 Date: Wed, 6 Aug 2025 20:01:28 +0530 Subject: [PATCH 1/3] fix: incorrect arrow direction in block direction on-behalf-of: @Mermaid-Chart --- cypress/integration/rendering/block.spec.js | 21 +++++++++++++++++++ .../mermaid/src/diagrams/block/blockDB.ts | 10 +++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/cypress/integration/rendering/block.spec.js b/cypress/integration/rendering/block.spec.js index f01d59375..cdaad90d4 100644 --- a/cypress/integration/rendering/block.spec.js +++ b/cypress/integration/rendering/block.spec.js @@ -393,6 +393,27 @@ describe('Block diagram', () => { overflow:3 short:1 also_overflow:2 +`, + {} + ); + }); + + it('BL31: edge without arrow syntax should render with no arrowheads', () => { + imgSnapshotTest( + `block-beta + a + b + a --- b +`, + {} + ); + }); + it('BL32: edge with arrow syntax should render with arrowheads', () => { + imgSnapshotTest( + `block-beta + a + b + a --> b `, {} ); diff --git a/packages/mermaid/src/diagrams/block/blockDB.ts b/packages/mermaid/src/diagrams/block/blockDB.ts index 39a8b47a0..b291be61e 100644 --- a/packages/mermaid/src/diagrams/block/blockDB.ts +++ b/packages/mermaid/src/diagrams/block/blockDB.ts @@ -238,13 +238,15 @@ export function edgeTypeStr2Type(typeStr: string): string { } export function edgeStrToEdgeData(typeStr: string): string { - switch (typeStr.trim()) { - case '--x': + switch (typeStr.replace(/^[\s-]+|[\s-]+$/g, '')) { + case 'x': return 'arrow_cross'; - case '--o': + case 'o': return 'arrow_circle'; - default: + case '>': return 'arrow_point'; + default: + return ''; } } From 9258b2933bbe1ef41087345ffea3731673671c49 Mon Sep 17 00:00:00 2001 From: darshanr0107 Date: Wed, 6 Aug 2025 20:05:35 +0530 Subject: [PATCH 2/3] add changeset on-behalf-of: @Mermaid-Chart --- .changeset/strong-dryers-pay.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/strong-dryers-pay.md diff --git a/.changeset/strong-dryers-pay.md b/.changeset/strong-dryers-pay.md new file mode 100644 index 000000000..495cde202 --- /dev/null +++ b/.changeset/strong-dryers-pay.md @@ -0,0 +1,5 @@ +--- +'mermaid': patch +--- + +fix: correctly render non-directional lines for '---' in block diagrams From 165ffefad59b6a80e95af0a6e6a9f42024a7aa89 Mon Sep 17 00:00:00 2001 From: darshanr0107 Date: Thu, 7 Aug 2025 12:09:49 +0530 Subject: [PATCH 3/3] chore: remove unnecessary test case on-behalf-of: @Mermaid-Chart --- cypress/integration/rendering/block.spec.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/cypress/integration/rendering/block.spec.js b/cypress/integration/rendering/block.spec.js index cdaad90d4..180c0093d 100644 --- a/cypress/integration/rendering/block.spec.js +++ b/cypress/integration/rendering/block.spec.js @@ -404,16 +404,6 @@ describe('Block diagram', () => { a b a --- b -`, - {} - ); - }); - it('BL32: edge with arrow syntax should render with arrowheads', () => { - imgSnapshotTest( - `block-beta - a - b - a --> b `, {} );