From 337ff3c32b954987ec64ae740272b85bfd9eb71a Mon Sep 17 00:00:00 2001 From: Jason Curtis Date: Wed, 16 Aug 2023 13:52:49 -0700 Subject: [PATCH 1/3] Documentation for #2509 --- packages/mermaid/src/docs/syntax/flowchart.md | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/mermaid/src/docs/syntax/flowchart.md b/packages/mermaid/src/docs/syntax/flowchart.md index 56cad19a0..16c9cc84d 100644 --- a/packages/mermaid/src/docs/syntax/flowchart.md +++ b/packages/mermaid/src/docs/syntax/flowchart.md @@ -471,6 +471,29 @@ flowchart LR B1 --> B2 ``` +#### Limitation + +If any of a subgraph's nodes are linked to the outside, subgraph direction will be ignored. Instead the subgraph will inherit the direction of the parent graph: + +```mermaid-example +flowchart LR + subgraph subgraph1 + direction TB + top1[top] --> bottom1[bottom] + end + subgraph subgraph2 + direction TB + top2[top] --> bottom2[bottom] + end + %% ^ These subgraphs are identical, except for the links to them: + + %% Link *to* subgraph1: subgraph1 direction is mantained + outside --> subgraph1 + %% Link *within* subgraph2: + %% subgraph2 inherits the direction of the top-level graph (LR) + outside ---> top2 +``` + ## Markdown Strings The "Markdown Strings" feature enhances flowcharts and mind maps by offering a more versatile string type, which supports text formatting options such as bold and italics, and automatically wraps text within labels. From ef8b75a6da2e0074529028e8a373dcd60a8f1967 Mon Sep 17 00:00:00 2001 From: Jason Curtis Date: Thu, 17 Aug 2023 03:32:42 +0000 Subject: [PATCH 2/3] Remove whitespace on empty line --- packages/mermaid/src/docs/syntax/flowchart.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mermaid/src/docs/syntax/flowchart.md b/packages/mermaid/src/docs/syntax/flowchart.md index 16c9cc84d..01a33cf40 100644 --- a/packages/mermaid/src/docs/syntax/flowchart.md +++ b/packages/mermaid/src/docs/syntax/flowchart.md @@ -486,7 +486,7 @@ flowchart LR top2[top] --> bottom2[bottom] end %% ^ These subgraphs are identical, except for the links to them: - + %% Link *to* subgraph1: subgraph1 direction is mantained outside --> subgraph1 %% Link *within* subgraph2: From edb6ceae435dbb486ca22ece82eca1ab092a24f6 Mon Sep 17 00:00:00 2001 From: Jason Curtis Date: Thu, 17 Aug 2023 03:48:00 +0000 Subject: [PATCH 3/3] build docs --- docs/syntax/flowchart.md | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/docs/syntax/flowchart.md b/docs/syntax/flowchart.md index 0440c9169..ee635d451 100644 --- a/docs/syntax/flowchart.md +++ b/docs/syntax/flowchart.md @@ -748,6 +748,48 @@ flowchart LR B1 --> B2 ``` +#### Limitation + +If any of a subgraph's nodes are linked to the outside, subgraph direction will be ignored. Instead the subgraph will inherit the direction of the parent graph: + +```mermaid-example +flowchart LR + subgraph subgraph1 + direction TB + top1[top] --> bottom1[bottom] + end + subgraph subgraph2 + direction TB + top2[top] --> bottom2[bottom] + end + %% ^ These subgraphs are identical, except for the links to them: + + %% Link *to* subgraph1: subgraph1 direction is mantained + outside --> subgraph1 + %% Link *within* subgraph2: + %% subgraph2 inherits the direction of the top-level graph (LR) + outside ---> top2 +``` + +```mermaid +flowchart LR + subgraph subgraph1 + direction TB + top1[top] --> bottom1[bottom] + end + subgraph subgraph2 + direction TB + top2[top] --> bottom2[bottom] + end + %% ^ These subgraphs are identical, except for the links to them: + + %% Link *to* subgraph1: subgraph1 direction is mantained + outside --> subgraph1 + %% Link *within* subgraph2: + %% subgraph2 inherits the direction of the top-level graph (LR) + outside ---> top2 +``` + ## Markdown Strings The "Markdown Strings" feature enhances flowcharts and mind maps by offering a more versatile string type, which supports text formatting options such as bold and italics, and automatically wraps text within labels.