From 549c20b2a3657be671907c45f8da87c4379a9ed8 Mon Sep 17 00:00:00 2001 From: Jason Curtis Date: Wed, 16 Aug 2023 13:52:49 -0700 Subject: [PATCH] Documentation for #2509 --- docs/syntax/flowchart.md | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/docs/syntax/flowchart.md b/docs/syntax/flowchart.md index 0440c91691f..42caf1d9209 100644 --- a/docs/syntax/flowchart.md +++ b/docs/syntax/flowchart.md @@ -748,6 +748,48 @@ flowchart LR B1 --> B2 ``` +#### Limitation + +Subgraph direction only takes effect if none of the subgraph nodes are linked to the outside: + +```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.