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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat | Vertical branches in Git Diagram #4639

Conversation

mastersibin
Copy link
Contributor

@mastersibin mastersibin commented Jul 15, 2023

A new feature that helps create Vertical branches for GitDiagram.
Resolves #2585
Issue #4451 closed as a duplicate, please refer to #2585
Discussed #3772

@codecov
Copy link

codecov bot commented Jul 15, 2023

Codecov Report

Merging #4639 (bb7b349) into develop (38f2ff0) will increase coverage by 31.80%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##           develop    #4639       +/-   ##
============================================
+ Coverage    45.32%   77.13%   +31.80%     
============================================
  Files           52      143       +91     
  Lines         6645    14535     +7890     
  Branches        18      516      +498     
============================================
+ Hits          3012    11211     +8199     
+ Misses        3633     3219      -414     
- Partials         0      105      +105     
Flag Coverage Δ
e2e 84.09% <100.00%> (?)
unit 45.32% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...kages/mermaid/src/diagrams/git/gitGraphRenderer.js 98.14% <100.00%> (ø)

... and 136 files with indirect coverage changes

Copy link
Contributor

@nirname nirname left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need tests covering this feature. Without them it would be very difficult to say if smth broke

@nirname
Copy link
Contributor

nirname commented Jul 15, 2023

Looks great!
Some recommendations:

  • Branches names unfortunately overlap each other. May be we need an option to turn them 45 degree.
  • Perhaps it would be better to place labels for commits at the right or at the left depending on how close the commit is to the left or right side of the rendered image

@mastersibin
Copy link
Contributor Author

mastersibin commented Jul 16, 2023

Looks great! Some recommendations:

  • Branches names unfortunately overlap each other. May be we need an option to turn them 45 degree.
  • Perhaps it would be better to place labels for commits at the right or at the left depending on how close the commit is to the left or right side of the rendered image

Agree, I'll make the branch names turn 45 degrees.
What if both left and right branches are close, how would we put the labels then?

@nirname
Copy link
Contributor

nirname commented Jul 16, 2023

You could play around while placing labels. Ensure that they are not cut, may be some edge-cases in tests would cover that

@mastersibin
Copy link
Contributor Author

You could play around while placing labels. Ensure that they are not cut, maybe some edge-cases in tests would cover that

If the label is long it will cut no matter what. Can we have some threshold, that we guarantee, below which it won't cut?

@nirname
Copy link
Contributor

nirname commented Jul 16, 2023

Not sure, there is no correct answer to that. Every diagram at some point will become unreadable. You simply cannot fit certain image in a very small boundaries. But for the majority of the cases I would simply took some real branches names for instance from that very project, or from any other one and would put them in a test case

@mastersibin
Copy link
Contributor Author

mastersibin commented Jul 17, 2023

Not sure, there is no correct answer to that. Every diagram at some point will become unreadable. You simply cannot fit certain image in a very small boundaries. But for the majority of the cases I would simply took some real branches names for instance from that very project, or from any other one and would put them in a test case

One thing I found was, if you rotate branch names, it will interfere with the title of the diagram. A probable solution can be, to space branches according to branch name length.
image

@nirname nirname self-requested a review July 19, 2023 16:05
Copy link
Contributor

@nirname nirname left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be refactored a little bit to be more readable, but that is not the task. Great job. I am approving it. The only missing thing is the documentation. It would be great to add it with this PR, so as not to forget about it.

@nirname nirname self-assigned this Jul 21, 2023
@nirname
Copy link
Contributor

nirname commented Jul 21, 2023

I am merging this, but the code in its current state needs total refactoring, this is very difficult to understand what is happening there. Perhaps we need to redo the whole thing

@nirname nirname added this pull request to the merge queue Jul 21, 2023
Merged via the queue into mermaid-js:develop with commit a3c645c Jul 21, 2023
@mermaid-bot
Copy link

mermaid-bot bot commented Jul 21, 2023

@mastersibin, Thank you for the contribution!
You are now eligible for a year of Premium account on MermaidChart.
Sign up with your GitHub account to activate.

github-merge-queue bot referenced this pull request in fuxingloh/contented Jul 31, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [mermaid](https://togithub.com/mermaid-js/mermaid) | [`10.2.4` ->
`10.3.0`](https://renovatebot.com/diffs/npm/mermaid/10.2.4/10.3.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/mermaid/10.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/mermaid/10.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/mermaid/10.2.4/10.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/mermaid/10.2.4/10.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>mermaid-js/mermaid (mermaid)</summary>

###
[`v10.3.0`](https://togithub.com/mermaid-js/mermaid/releases/tag/v10.3.0):
10.3.0

[Compare
Source](https://togithub.com/mermaid-js/mermaid/compare/v10.2.4...v10.3.0)

#### What's Changed

##### Features

- Sankey diagrams by [@&#8203;nirname](https://togithub.com/nirname) in
[https://github.com/mermaid-js/mermaid/pull/4502](https://togithub.com/mermaid-js/mermaid/pull/4502)
- Feature/1838 actor creation destruction by
[@&#8203;Valentine14th](https://togithub.com/Valentine14th) in
[https://github.com/mermaid-js/mermaid/pull/4466](https://togithub.com/mermaid-js/mermaid/pull/4466)
- Vertical branches in Git Diagram by
[@&#8203;mastersibin](https://togithub.com/mastersibin) in
[https://github.com/mermaid-js/mermaid/pull/4639](https://togithub.com/mermaid-js/mermaid/pull/4639)
- Use JSON Schema to define and document `MermaidConfig` by
[@&#8203;aloisklink](https://togithub.com/aloisklink) in
[https://github.com/mermaid-js/mermaid/pull/4112](https://togithub.com/mermaid-js/mermaid/pull/4112)
- Remove the test checking whether the JSON Schema default config
matched the old default config by
[@&#8203;aloisklink](https://togithub.com/aloisklink) in
[https://github.com/mermaid-js/mermaid/pull/4610](https://togithub.com/mermaid-js/mermaid/pull/4610)
- Fixes support of the macro `ContainerQueue_Ext` for C4 diagrams
definition. by [@&#8203;kislerdm](https://togithub.com/kislerdm) in
[https://github.com/mermaid-js/mermaid/pull/4577](https://togithub.com/mermaid-js/mermaid/pull/4577)

##### Bugfixes

- Make quadrant chart options TypeScript types optional by
[@&#8203;aloisklink](https://togithub.com/aloisklink) in
[https://github.com/mermaid-js/mermaid/pull/4602](https://togithub.com/mermaid-js/mermaid/pull/4602)
- Remove double parsing by
[@&#8203;nirname](https://togithub.com/nirname) in
[https://github.com/mermaid-js/mermaid/pull/4587](https://togithub.com/mermaid-js/mermaid/pull/4587)
- Fix flowchart tooltip typing bug by
[@&#8203;lishid](https://togithub.com/lishid) in
[https://github.com/mermaid-js/mermaid/pull/4562](https://togithub.com/mermaid-js/mermaid/pull/4562)
- Bug/4590 allow notes identical to keywords by
[@&#8203;ibrahimWassouf](https://togithub.com/ibrahimWassouf) in
[https://github.com/mermaid-js/mermaid/pull/4597](https://togithub.com/mermaid-js/mermaid/pull/4597)
- feat: allow specifying on which weekday a tickInterval should start by
[@&#8203;leinelissen](https://togithub.com/leinelissen) in
[https://github.com/mermaid-js/mermaid/pull/4634](https://togithub.com/mermaid-js/mermaid/pull/4634)
- Split formatted markdown strings with unicode support. by
[@&#8203;sidharthv96](https://togithub.com/sidharthv96) in
[https://github.com/mermaid-js/mermaid/pull/4470](https://togithub.com/mermaid-js/mermaid/pull/4470)
- fix: Mind maps handles `-` signs in node ids/text by
[@&#8203;knsv](https://togithub.com/knsv)

##### Chores

- Remove all TypeScript enums and forbid them in ESLint by
[@&#8203;aloisklink](https://togithub.com/aloisklink) in
[https://github.com/mermaid-js/mermaid/pull/4580](https://togithub.com/mermaid-js/mermaid/pull/4580)
- refactor accessibility by
[@&#8203;Yokozuna59](https://togithub.com/Yokozuna59) in
[https://github.com/mermaid-js/mermaid/pull/4551](https://togithub.com/mermaid-js/mermaid/pull/4551)
- chore: Reduce codecov pushes by
[@&#8203;sidharthv96](https://togithub.com/sidharthv96) in
[https://github.com/mermaid-js/mermaid/pull/4604](https://togithub.com/mermaid-js/mermaid/pull/4604)
- Run PR-labeler-config-validator only if config changes by
[@&#8203;sidharthv96](https://togithub.com/sidharthv96) in
[https://github.com/mermaid-js/mermaid/pull/4607](https://togithub.com/mermaid-js/mermaid/pull/4607)
- chore(deps): update all minor dependencies (minor) by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/mermaid-js/mermaid/pull/4624](https://togithub.com/mermaid-js/mermaid/pull/4624)
- Update all patch dependencies (patch) by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/mermaid-js/mermaid/pull/4566](https://togithub.com/mermaid-js/mermaid/pull/4566)
- Update all patch dependencies (patch) by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/mermaid-js/mermaid/pull/4581](https://togithub.com/mermaid-js/mermaid/pull/4581)
- Rename workflow jobs by
[@&#8203;sidharthv96](https://togithub.com/sidharthv96) in
[https://github.com/mermaid-js/mermaid/pull/4574](https://togithub.com/mermaid-js/mermaid/pull/4574)
- Removed unused code in state diagrams by
[@&#8203;nirname](https://togithub.com/nirname) in
[https://github.com/mermaid-js/mermaid/pull/4631](https://togithub.com/mermaid-js/mermaid/pull/4631)
- chore(deps): update all patch dependencies (patch) by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/mermaid-js/mermaid/pull/4623](https://togithub.com/mermaid-js/mermaid/pull/4623)
- chore: remove unused `devDependency` on coveralls by
[@&#8203;aloisklink](https://togithub.com/aloisklink) in
[https://github.com/mermaid-js/mermaid/pull/4641](https://togithub.com/mermaid-js/mermaid/pull/4641)
- Allow entity diagram attribute names to start with asterisk by
[@&#8203;ibrahimWassouf](https://togithub.com/ibrahimWassouf) in
[https://github.com/mermaid-js/mermaid/pull/4588](https://togithub.com/mermaid-js/mermaid/pull/4588)
- Bug/4592 fix new line padding class diagram by
[@&#8203;ibrahimWassouf](https://togithub.com/ibrahimWassouf) in
[https://github.com/mermaid-js/mermaid/pull/4633](https://togithub.com/mermaid-js/mermaid/pull/4633)
- Fix graph not loading when the img loads too fast or fail to load by
[@&#8203;pierrickouw](https://togithub.com/pierrickouw) in
[https://github.com/mermaid-js/mermaid/pull/4496](https://togithub.com/mermaid-js/mermaid/pull/4496)
- convert `cypress/helpers/util.js` to ts by
[@&#8203;Yokozuna59](https://togithub.com/Yokozuna59) in
[https://github.com/mermaid-js/mermaid/pull/4552](https://togithub.com/mermaid-js/mermaid/pull/4552)
- build(deps-dev): bump word-wrap from 1.2.3 to 1.2.4 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/mermaid-js/mermaid/pull/4652](https://togithub.com/mermaid-js/mermaid/pull/4652)
- chore(deps): update all minor dependencies (minor) by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/mermaid-js/mermaid/pull/4663](https://togithub.com/mermaid-js/mermaid/pull/4663)
- chore(deps): update all patch dependencies (patch) by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/mermaid-js/mermaid/pull/4662](https://togithub.com/mermaid-js/mermaid/pull/4662)

##### Documentation

- Sankey: Remove duplicated examples by
[@&#8203;nirname](https://togithub.com/nirname) in
[https://github.com/mermaid-js/mermaid/pull/4595](https://togithub.com/mermaid-js/mermaid/pull/4595)
- Release docs by
[@&#8203;sidharthv96](https://togithub.com/sidharthv96) in
[https://github.com/mermaid-js/mermaid/pull/4493](https://togithub.com/mermaid-js/mermaid/pull/4493)
- Update latest news section by
[@&#8203;huynhicode](https://togithub.com/huynhicode) in
[https://github.com/mermaid-js/mermaid/pull/4495](https://togithub.com/mermaid-js/mermaid/pull/4495)
- Fix Typo by [@&#8203;ryru](https://togithub.com/ryru) in
[https://github.com/mermaid-js/mermaid/pull/4567](https://togithub.com/mermaid-js/mermaid/pull/4567)
- Docs: add ChatGPT plugin blog post by
[@&#8203;huynhicode](https://togithub.com/huynhicode) in
[https://github.com/mermaid-js/mermaid/pull/4570](https://togithub.com/mermaid-js/mermaid/pull/4570)
- Fix relative link to theme variables list by
[@&#8203;ibrahimWassouf](https://togithub.com/ibrahimWassouf) in
[https://github.com/mermaid-js/mermaid/pull/4573](https://togithub.com/mermaid-js/mermaid/pull/4573)
- Fix docs:dev by
[@&#8203;sidharthv96](https://togithub.com/sidharthv96) in
[https://github.com/mermaid-js/mermaid/pull/4598](https://togithub.com/mermaid-js/mermaid/pull/4598)
- Docs: update link - "Join the Community" by
[@&#8203;huynhicode](https://togithub.com/huynhicode) in
[https://github.com/mermaid-js/mermaid/pull/4601](https://togithub.com/mermaid-js/mermaid/pull/4601)
- Support docs:dev in docker by
[@&#8203;nirname](https://togithub.com/nirname) in
[https://github.com/mermaid-js/mermaid/pull/4599](https://togithub.com/mermaid-js/mermaid/pull/4599)
- docs(flowchart): add documentation on multiple nodes style by
[@&#8203;tomperr](https://togithub.com/tomperr) in
[https://github.com/mermaid-js/mermaid/pull/4600](https://togithub.com/mermaid-js/mermaid/pull/4600)
- Avoid downloading avtars everytime on docs:dev by
[@&#8203;sidharthv96](https://togithub.com/sidharthv96) in
[https://github.com/mermaid-js/mermaid/pull/4603](https://togithub.com/mermaid-js/mermaid/pull/4603)
- docs: Fix checkbox syntax by
[@&#8203;guilhermgonzaga](https://togithub.com/guilhermgonzaga) in
[https://github.com/mermaid-js/mermaid/pull/4646](https://togithub.com/mermaid-js/mermaid/pull/4646)
- Fix the "Edit this page on GitHub" link in Vitepress documentation for
the Mermaid Config pages by
[@&#8203;aloisklink](https://togithub.com/aloisklink) in
[https://github.com/mermaid-js/mermaid/pull/4640](https://togithub.com/mermaid-js/mermaid/pull/4640)
- Support MERMAID_RELEASE_VERSION in docs. by
[@&#8203;sidharthv96](https://togithub.com/sidharthv96) in
[https://github.com/mermaid-js/mermaid/pull/4612](https://togithub.com/mermaid-js/mermaid/pull/4612)
- Docs: update Latest News section by
[@&#8203;huynhicode](https://togithub.com/huynhicode) in
[https://github.com/mermaid-js/mermaid/pull/4655](https://togithub.com/mermaid-js/mermaid/pull/4655)
- added Typora to integrations list by
[@&#8203;kgilbert78](https://togithub.com/kgilbert78) in
[https://github.com/mermaid-js/mermaid/pull/4666](https://togithub.com/mermaid-js/mermaid/pull/4666)
- Docs: Corrects name of C4 link by
[@&#8203;Incognito](https://togithub.com/Incognito) in
[https://github.com/mermaid-js/mermaid/pull/4660](https://togithub.com/mermaid-js/mermaid/pull/4660)
- Fix a typo by [@&#8203;gjtorikian](https://togithub.com/gjtorikian) in
[https://github.com/mermaid-js/mermaid/pull/4396](https://togithub.com/mermaid-js/mermaid/pull/4396)

#### New Contributors

- [@&#8203;ryru](https://togithub.com/ryru) made their first
contribution in
[https://github.com/mermaid-js/mermaid/pull/4567](https://togithub.com/mermaid-js/mermaid/pull/4567)
- [@&#8203;ibrahimWassouf](https://togithub.com/ibrahimWassouf) made
their first contribution in
[https://github.com/mermaid-js/mermaid/pull/4573](https://togithub.com/mermaid-js/mermaid/pull/4573)
- [@&#8203;kislerdm](https://togithub.com/kislerdm) made their first
contribution in
[https://github.com/mermaid-js/mermaid/pull/4577](https://togithub.com/mermaid-js/mermaid/pull/4577)
- [@&#8203;leinelissen](https://togithub.com/leinelissen) made their
first contribution in
[https://github.com/mermaid-js/mermaid/pull/4634](https://togithub.com/mermaid-js/mermaid/pull/4634)
- [@&#8203;pierrickouw](https://togithub.com/pierrickouw) made their
first contribution in
[https://github.com/mermaid-js/mermaid/pull/4496](https://togithub.com/mermaid-js/mermaid/pull/4496)
- [@&#8203;mastersibin](https://togithub.com/mastersibin) made their
first contribution in
[https://github.com/mermaid-js/mermaid/pull/4639](https://togithub.com/mermaid-js/mermaid/pull/4639)
- [@&#8203;kgilbert78](https://togithub.com/kgilbert78) made their first
contribution in
[https://github.com/mermaid-js/mermaid/pull/4666](https://togithub.com/mermaid-js/mermaid/pull/4666)
- [@&#8203;Incognito](https://togithub.com/Incognito) made their first
contribution in
[https://github.com/mermaid-js/mermaid/pull/4660](https://togithub.com/mermaid-js/mermaid/pull/4660)
- [@&#8203;gjtorikian](https://togithub.com/gjtorikian) made their first
contribution in
[https://github.com/mermaid-js/mermaid/pull/4396](https://togithub.com/mermaid-js/mermaid/pull/4396)

**Full Changelog**:
mermaid-js/mermaid@v10.2.4...v10.3.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/levaintech/contented).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMS4wIiwidXBkYXRlZEluVmVyIjoiMzYuMTEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@yogeshg
Copy link

yogeshg commented Nov 30, 2023

Is it me, or should this work in github?

gitGraph TB:
       commit id: "1"
       commit id: "2"
       commit id: "3"
Loading
Screenshot 2023-11-30 at 7 55 14 AM

@nirname
Copy link
Contributor

nirname commented Nov 30, 2023

@yogeshg I think this is because of GitHub. You can check if it is working on mermaid.live

@yogeshg
Copy link

yogeshg commented Nov 30, 2023

Oh gotcha. Thanks for the information. Since what version is this present in? Also, Do you know where I can request GitHub to update that version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GitGraph: How to change the orientation? Vertical branches support
5 participants