Skip to content

Commit

Permalink
Merge pull request #5916 from iSparsh/docs/5836_add-horizontal-block-…
Browse files Browse the repository at this point in the history
…merging-instructions

Added documentation about merging blocks horizontally (Resolves #5836)
  • Loading branch information
sidharthv96 authored Oct 3, 2024
2 parents f6adca9 + d50a6cf commit c7382af
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/syntax/block.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,27 @@ block-beta

This example demonstrates how Mermaid dynamically adjusts the width of the columns to accommodate the widest block, in this case, 'a' and the composite block 'e'. This dynamic adjustment is essential for creating visually balanced and easy-to-understand diagrams.

**Merging Blocks Horizontally:**
In scenarios where you need to stack blocks horizontally, you can use column width to accomplish the task. Blocks can be arranged vertically by putting them in a single column. Here is how you can create a block diagram in which 4 blocks are stacked on top of each other:

```mermaid-example
block-beta
block
columns 1
a["A label"] b c d
end
```

```mermaid
block-beta
block
columns 1
a["A label"] b c d
end
```

In this example, the width of the merged block dynamically adjusts to the width of the largest child block.

With these advanced configuration options, Mermaid's block diagrams can be tailored to represent a wide array of complex systems and structures. The flexibility offered by these features enables users to create diagrams that are both informative and visually appealing. In the following sections, we will explore further capabilities, including different block shapes and linking options.

## 4. Block Varieties and Shapes
Expand Down
13 changes: 13 additions & 0 deletions packages/mermaid/src/docs/syntax/block.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,19 @@ block-beta

This example demonstrates how Mermaid dynamically adjusts the width of the columns to accommodate the widest block, in this case, 'a' and the composite block 'e'. This dynamic adjustment is essential for creating visually balanced and easy-to-understand diagrams.

**Merging Blocks Horizontally:**
In scenarios where you need to stack blocks horizontally, you can use column width to accomplish the task. Blocks can be arranged vertically by putting them in a single column. Here is how you can create a block diagram in which 4 blocks are stacked on top of each other:

```mermaid-example
block-beta
block
columns 1
a["A label"] b c d
end
```

In this example, the width of the merged block dynamically adjusts to the width of the largest child block.

With these advanced configuration options, Mermaid's block diagrams can be tailored to represent a wide array of complex systems and structures. The flexibility offered by these features enables users to create diagrams that are both informative and visually appealing. In the following sections, we will explore further capabilities, including different block shapes and linking options.

## 4. Block Varieties and Shapes
Expand Down

0 comments on commit c7382af

Please sign in to comment.