Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update notes on orientation in GitGraph documentation #4897

Merged
merged 4 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions docs/syntax/gitgraph.md
Original file line number Diff line number Diff line change
Expand Up @@ -827,18 +827,19 @@ Here, we have changed the default main branch name to `MetroLine1`.

## Orientation (v10.3.0+)

In Mermaid, the default orientation is Left to Right. The branches are lined vertically.
In Mermaid, the default orientation is for commits to run from **left to right** and for branches to be stacked on top of one another.

You can set this explicitly with `LR:` after `gitGraph`.

Usage example:

```mermaid-example
gitGraph
gitGraph LR:
commit
commit
branch develop
commit
commit
commit
checkout main
commit
commit
Expand All @@ -848,13 +849,12 @@ Usage example:
```

```mermaid
gitGraph
gitGraph LR:
commit
commit
branch develop
commit
commit
commit
checkout main
commit
commit
Expand All @@ -863,9 +863,11 @@ Usage example:
commit
```

Sometimes we may want to change the orientation. Currently, Mermaid supports two orientations: **Left to Right**(default) and **Top to Bottom**.
Sometimes, we may want to change the orientation of the graph.

Mermaid also supports a **top to bottom** orientation. In this mode, the commits run from top to bottom of the graph and branches are arranged side-by-side.

In order to change the orientation from top to bottom i.e. branches lined horizontally, you need to add `TB` along with `gitGraph`.
To orient the graph in this way, you need to add `TB:` after gitGraph.

Usage example:

Expand All @@ -876,7 +878,6 @@ Usage example:
branch develop
commit
commit
commit
checkout main
commit
commit
Expand All @@ -892,7 +893,6 @@ Usage example:
branch develop
commit
commit
commit
checkout main
commit
commit
Expand Down
14 changes: 8 additions & 6 deletions packages/mermaid/src/docs/syntax/gitgraph.md
Original file line number Diff line number Diff line change
Expand Up @@ -513,18 +513,19 @@ Here, we have changed the default main branch name to `MetroLine1`.

## Orientation (v10.3.0+)

In Mermaid, the default orientation is Left to Right. The branches are lined vertically.
In Mermaid, the default orientation is for commits to run from **left to right** and for branches to be stacked on top of one another.

You can set this explicitly with `LR:` after `gitGraph`.
guypursey marked this conversation as resolved.
Show resolved Hide resolved

guypursey marked this conversation as resolved.
Show resolved Hide resolved
Usage example:

```mermaid-example
gitGraph
gitGraph LR:
commit
commit
branch develop
commit
commit
commit
checkout main
commit
commit
Expand All @@ -533,9 +534,11 @@ Usage example:
commit
```

Sometimes we may want to change the orientation. Currently, Mermaid supports two orientations: **Left to Right**(default) and **Top to Bottom**.
Sometimes, we may want to change the orientation of the graph.

In order to change the orientation from top to bottom i.e. branches lined horizontally, you need to add `TB` along with `gitGraph`.
Mermaid also supports a **top to bottom** orientation. In this mode, the commits run from top to bottom of the graph and branches are arranged side-by-side.
guypursey marked this conversation as resolved.
Show resolved Hide resolved

To orient the graph in this way, you need to add `TB:` after gitGraph.

Usage example:

Expand All @@ -546,7 +549,6 @@ Usage example:
branch develop
commit
commit
commit
checkout main
commit
commit
Expand Down