From e9ce8cf4da9062d85098042044822100889bb0dd Mon Sep 17 00:00:00 2001 From: Krishna Upadhyay <24423580+kriss-u@users.noreply.github.com> Date: Thu, 10 Jul 2025 21:39:19 -0500 Subject: [PATCH] fix: trim the direction string in flowchart --- .changeset/smart-humans-cover.md | 5 +++++ packages/mermaid/src/diagrams/flowchart/flowDb.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/smart-humans-cover.md diff --git a/.changeset/smart-humans-cover.md b/.changeset/smart-humans-cover.md new file mode 100644 index 000000000..4408e0a9c --- /dev/null +++ b/.changeset/smart-humans-cover.md @@ -0,0 +1,5 @@ +--- +'mermaid': patch +--- + +fix: Update flowchart direction TD's behavior to be the same as TB diff --git a/packages/mermaid/src/diagrams/flowchart/flowDb.ts b/packages/mermaid/src/diagrams/flowchart/flowDb.ts index 65f8c4a05..303ad0e66 100644 --- a/packages/mermaid/src/diagrams/flowchart/flowDb.ts +++ b/packages/mermaid/src/diagrams/flowchart/flowDb.ts @@ -403,7 +403,8 @@ You have to call mermaid.initialize.` * */ public setDirection(dir: string) { - this.direction = dir; + this.direction = dir.trim(); + if (/.*