From 74c96db3e2f4077eee742ec6944ef2585360b2ad Mon Sep 17 00:00:00 2001 From: omkarht Date: Thu, 7 Aug 2025 12:47:31 +0530 Subject: [PATCH] docs: document new syntax for half-arrow message and central connection on-behalf-of: @Mermaid-Chart --- docs/syntax/sequenceDiagram.md | 76 ++++++++++++++++++- .../src/docs/syntax/sequenceDiagram.md | 58 +++++++++++++- 2 files changed, 132 insertions(+), 2 deletions(-) diff --git a/docs/syntax/sequenceDiagram.md b/docs/syntax/sequenceDiagram.md index 84240a0cd..d3d5808bb 100644 --- a/docs/syntax/sequenceDiagram.md +++ b/docs/syntax/sequenceDiagram.md @@ -209,7 +209,11 @@ Messages can be of two displayed either solid or with a dotted line. [Actor][Arrow][Actor]:Message text ``` -There are ten types of arrows currently supported: +Lines can be solid or dotted, and can end with various types of arrowheads, crosses, or open arrows. + +#### Supported Arrow Types + +**Standard Arrow Types** | Type | Description | | -------- | ---------------------------------------------------- | @@ -224,6 +228,76 @@ There are ten types of arrows currently supported: | `-)` | Solid line with an open arrow at the end (async) | | `--)` | Dotted line with a open arrow at the end (async) | +**New Half-Arrows** + +The following half-arrow types are now supported for more expressive sequence diagrams. Both solid and dotted variants are available by increasing the number of dashes (`-` → `--`). + +--- + +\| Type | Description | +\| ------- | ---------------------------------------------------- | ---------------------------------------------- | +\| `-\|\` | Solid line with top half arrowhead | +\| `--\|\` | Dotted line with top half arrowhead | +\| `-\|/` | Solid line with bottom half arrowhead | +\| `--\|/` | Dotted line with bottom half arrowhead | +\| `/\|-` | Solid line with reverse top half arrowhead | +\| `/\|--` | Dotted line with reverse top half arrowhead | +\| `\\ | -` | Solid line with reverse bottom half arrowhead | +\| `\\ | --` | Dotted line with reverse bottom half arrowhead | +\| `-\\` | Solid line with top stick half arrowhead | +\| `--\\` | Dotted line with top stick half arrowhead | +\| `-//` | Solid line with bottom stick half arrowhead | +\| `--//` | Dotted line with bottom stick half arrowhead | +\| `//-` | Solid line with reverse top stick half arrowhead | +\| `//--` | Dotted line with reverse top stick half arrowhead | +\| `\\-` | Solid line with reverse bottom stick half arrowhead | +\| `\\--` | Dotted line with reverse bottom stick half arrowhead | + +## Central Connections + +Mermaid sequence diagrams now support **central lifeline connections** using a `()`.\ +This is useful to represent messages or signals that connect to a central point, rather than from one actor directly to another. + +To indicate a central connection, append `()` to the arrow syntax. + +#### Basic Syntax + +```mermaid-example +sequenceDiagram + participant Alice + participant John + Alice->>()John: Hello John + Alice()->>John: How are you? + John()->>()Alice: Great! +``` + +```mermaid +sequenceDiagram + participant Alice + participant John + Alice->>()John: Hello John + Alice()->>John: How are you? + John()->>()Alice: Great! +``` + +```mermaid-example +sequenceDiagram + participant Alice + participant John + Alice->>()John: Hello John + Alice()->>John: How are you? + John()->>()Alice: Great! +``` + +```mermaid +sequenceDiagram + participant Alice + participant John + Alice->>()John: Hello John + Alice()->>John: How are you? + John()->>()Alice: Great! +``` + ## Activations It is possible to activate and deactivate an actor. (de)activation can be dedicated declarations: diff --git a/packages/mermaid/src/docs/syntax/sequenceDiagram.md b/packages/mermaid/src/docs/syntax/sequenceDiagram.md index 3087eb743..5112227a0 100644 --- a/packages/mermaid/src/docs/syntax/sequenceDiagram.md +++ b/packages/mermaid/src/docs/syntax/sequenceDiagram.md @@ -144,7 +144,11 @@ Messages can be of two displayed either solid or with a dotted line. [Actor][Arrow][Actor]:Message text ``` -There are ten types of arrows currently supported: +Lines can be solid or dotted, and can end with various types of arrowheads, crosses, or open arrows. + +#### Supported Arrow Types + +**Standard Arrow Types** | Type | Description | | -------- | ---------------------------------------------------- | @@ -159,6 +163,58 @@ There are ten types of arrows currently supported: | `-)` | Solid line with an open arrow at the end (async) | | `--)` | Dotted line with a open arrow at the end (async) | +**New Half-Arrows** + +The following half-arrow types are now supported for more expressive sequence diagrams. Both solid and dotted variants are available by increasing the number of dashes (`-` → `--`). + +--- + +| Type | Description | +| ------- | ---------------------------------------------------- | ---------------------------------------------- | +| `-\|\` | Solid line with top half arrowhead | +| `--\|\` | Dotted line with top half arrowhead | +| `-\|/` | Solid line with bottom half arrowhead | +| `--\|/` | Dotted line with bottom half arrowhead | +| `/\|-` | Solid line with reverse top half arrowhead | +| `/\|--` | Dotted line with reverse top half arrowhead | +| `\\ | -` | Solid line with reverse bottom half arrowhead | +| `\\ | --` | Dotted line with reverse bottom half arrowhead | +| `-\\` | Solid line with top stick half arrowhead | +| `--\\` | Dotted line with top stick half arrowhead | +| `-//` | Solid line with bottom stick half arrowhead | +| `--//` | Dotted line with bottom stick half arrowhead | +| `//-` | Solid line with reverse top stick half arrowhead | +| `//--` | Dotted line with reverse top stick half arrowhead | +| `\\-` | Solid line with reverse bottom stick half arrowhead | +| `\\--` | Dotted line with reverse bottom stick half arrowhead | + +## Central Connections + +Mermaid sequence diagrams now support **central lifeline connections** using a `()`. +This is useful to represent messages or signals that connect to a central point, rather than from one actor directly to another. + +To indicate a central connection, append `()` to the arrow syntax. + +#### Basic Syntax + +```mermaid-example +sequenceDiagram + participant Alice + participant John + Alice->>()John: Hello John + Alice()->>John: How are you? + John()->>()Alice: Great! +``` + +```mermaid +sequenceDiagram + participant Alice + participant John + Alice->>()John: Hello John + Alice()->>John: How are you? + John()->>()Alice: Great! +``` + ## Activations It is possible to activate and deactivate an actor. (de)activation can be dedicated declarations: