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

Add generic and array symbols to erDiagram #3335

Merged
merged 4 commits into from
Aug 23, 2022
Merged

Add generic and array symbols to erDiagram #3335

merged 4 commits into from
Aug 23, 2022

Conversation

FlorianWoelki
Copy link
Contributor

@FlorianWoelki FlorianWoelki commented Aug 20, 2022

📑 Summary

  • Add array ([]) and generic (~T~) support to erDiagram

Resolves part of #3171

📏 Design Decisions

The way the implementation works is that matches an ATTRIBUTE_WORD in a <block> before the normal match with the following regex <block>(.*?)[~](.*?)*[~]. This match gets directly parsed and evaluated at the erRenderer. In addition, I've added [] symbols to the normal parsing regex.

📋 Tasks

Make sure you

  • 📖 have read the contribution guidelines
  • 💻 have added unit/e2e tests (if appropriate)
  • 🔖 targeted develop branch


if (text.indexOf('~') != -1) {
cleanedText = cleanedText.replace('~', '<');
cleanedText = cleanedText.replace('~', '>');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could this be used to insert tags? Scared of < and > nowdays...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It shouldn't be the case because it gets inserted as a text. I've tried to insert some other styles without luck. The text just gets inserted. But thanks for pointing this out 💯

Copy link
Collaborator

@knsv knsv left a comment

Choose a reason for hiding this comment

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

Thanks! Good job!

@knsv knsv merged commit c507453 into mermaid-js:develop Aug 23, 2022
@FlorianWoelki FlorianWoelki deleted the feature/3171_erDiagram_more_symbols branch August 23, 2022 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants