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

[ErDiagram] Allow comments after entity name #2548

Open
xperiandri opened this issue Dec 9, 2021 · 7 comments
Open

[ErDiagram] Allow comments after entity name #2548

xperiandri opened this issue Dec 9, 2021 · 7 comments
Labels
Graph: Entity Relationship Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request

Comments

@xperiandri
Copy link

Is your feature request related to a problem? Please describe.
Usually, there is a need to describe the entity. So the ability to write a comment after an entity name would be extremely helpful!

Describe the solution you'd like
Add ability to specify a comment using '' quotes after an entity name at the end of the line or before the {

InitialSeller `(Company)` {
    ... 'attributes'
}
@sidharthv96 sidharthv96 transferred this issue from mermaid-js/mermaid-live-editor Dec 9, 2021
@github-actions github-actions bot added the Status: Triage Needs to be verified, categorized, etc label Dec 9, 2021
@RonaldZielaznicki
Copy link
Contributor

RonaldZielaznicki commented Dec 28, 2021

@xperiandri

The documentation is using single quotes while the jison file asks for double quotes.

You can see the proper use in the spec file too.

Looks like when I originally added the example image and code I didn't add in the example code, which was added in here.

And, I'm not remembering why I even used single quotes in the docs there. I think it had something to do with double quotes not behaving right? It's fuzzy. Either way, the fix for this would be to update the doc to use double quotes.

Going to ping @ddemoss222 since their ping is what pulled me over to look.

Oddly, even when using the right quotes, or just using PK/FK the ER diagram looks odd to me on the live editor. Which definitely wasn't how it looked when I originally pulled it together.

image

Related Issue
Related Issue 2

@ddemoss222
Copy link

@RonaldZielaznicki Yes, this is how it is rendering for me as well. It looks as though it renders the text on top of each other. From some of the comments I reviewed within the issues it seemed as though the feature was supposed to add a column to the rendering for PK/FK, but I never saw a mock for how the comments were meant to render. Thanks for looking into this

@RonaldZielaznicki
Copy link
Contributor

Looking a bit deeper, and at the second issue that I found on the live-editor side of things.

It looks like the error comes down to some math that wasn't done right here and here.

Both use typeRect to set their own x position. Which isn't right. That's just the first node in the box. The one that holds the type. Really, the x position should be added to after each node.

So there are two things needing to be done to fix what's going on.

First is the single quotes in the docs. The second is this math that isn't showing right. I'm currently not on a computer that can easily do development work. Those are where I'm seeing the problems.

Still confounds me, because I rather vividly remember using this code to make my own diagrams at the time for a project of my own I was working on at the time. Hence why I did the change in the first place. Bah, guess hindsight is 20/20 and memory is short. If no one fixes these issues by Wednesday I'll nab them on Thursday.

@Arakade
Copy link

Arakade commented Jan 24, 2022

Just came to say the comments aren't rendering and they're also broken on the project's website:

https://mermaid-js.github.io/mermaid/#/entityRelationshipDiagram?id=attribute-keys-and-comments

Glad to see you're already on this! Thanks 👍

@RonaldZielaznicki
Copy link
Contributor

It looks like this issue was fixed by @ebjornset in January with #2598. Many thanks for grabbing it!

Small snag, it renders correctly in the live editor.

image

But, it doesn't look to be doing the same in the docs

image

The docs are using 8.13.0, and the fix went through in release 8.13.9. That would explain why it's happening, but it's not a good look for the project and could cause confusion. Let's get that updated.

@xperiandri
Copy link
Author

My issue is about describing the whole entity, not its attributes.
Even if it is not visible. Just for documentation and explanation purposes.

@stumash
Copy link

stumash commented Apr 12, 2022

you should force github to update their mermaid version, it doesn't render correctly on github becuase they are probably pre-8.14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Graph: Entity Relationship Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants