mermaid icon indicating copy to clipboard operation
mermaid copied to clipboard

GitGraph support for multiple tags

Open sjackson0109 opened this issue 2 years ago • 5 comments

Proposal

Am trying to demonstrate practicing different diagrams to my coleagues for wiki via code repo, using markdown with mermaid support.

I stumbled across an issue trying to add multiple tags to a feature release.

Issue: CANNOT USE MULTIPLE TAGS

my code:

gitGraph
    commit id: "ZERO"
    branch develop
    commit id:"A"
    checkout main
    commit id:"ONE"
    checkout develop
    commit id:"B"
    checkout main
    merge develop id:"Release 1.0" type:HIGHLIGHT tag: "SAML v2.0" tag: "OpenID v1.1"
    commit id:"TWO"
    checkout develop
    commit id:"C"

As you can see before adding the string `tag: "OpenID v1.1" to line 10 above, the diagram rendered perfectly.. except for the second ta...

image

Error:

Error: Parse error on line 10: ...HT tag: "SAML v2.0" tag: "OpenID v1.1" -----------------------^ Expecting 'EOF', 'NL', ';', got 'COMMIT_TAG'

It would be amazing to use multiple tags, stacked vertically!

(note: GitHub, GitLab and Azure DevOps all support multiple tags)

Example

No response

Screenshots

No response

sjackson0109 avatar Nov 14 '22 23:11 sjackson0109

Tried all this with no luck:

  • Comma-separated list, encapsulated in quotes
  • Comma-separated list, without quotes
  • Brace separated array
  • multiple tag statements

sjackson0109 avatar Nov 14 '22 23:11 sjackson0109

I would very much like this feature! I don't have capacity to work on this right now, but I can see where I would start...

This function creates the commit object, which could be refactored to accept multiple tags: https://github.com/mermaid-js/mermaid/blob/549483d19b8f7f38d80944dbdbfd2ad1333f1238/packages/mermaid/src/diagrams/git/gitGraphAst.js#L112

This code renders tags, which could be refactored to render multiple tags or support new-line characters in tag names: https://github.com/mermaid-js/mermaid/blob/549483d19b8f7f38d80944dbdbfd2ad1333f1238/packages/mermaid/src/diagrams/git/gitGraphRenderer.js#L253


I can see how it would get tricky to render a multiline tag, as it might cause visual problems. I think supporting multiple tags is the way to go here.


Another consideration: if there are multiple tags on a commit, should the vertical distance between branches change to avoid overlapping?

mtilda avatar Jan 23 '23 21:01 mtilda

Hi @sidharthv96 wanted to check since you tagged this as fosshack, does this mean this issue is open to PRs?

Edit: Will be giving this a shot!

NicolasCwy avatar Feb 10 '24 15:02 NicolasCwy

@sidharthv96 From what I understand, I would have to amend the gitGraph.jison file to support multiple tag to be parsed is that correct? If you could link me to any guides on where I can learn this, the JISON repo seems quite dead and the linked BISON docs are dead too, I'm assuming this is based off BISON from GNU?

NicolasCwy avatar Feb 27 '24 10:02 NicolasCwy

I don't have any documentations, apart from the jison/bison repos. The grammar seems to be standard bison for most part.

We are actually migrating away from jison due to many issues.

sidharthv96 avatar Feb 27 '24 10:02 sidharthv96

Reviving this issue because I think this should be supported. Thanks creating the issue @sjackson0109

chardskarth avatar Jul 16 '24 02:07 chardskarth