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

classDiagram Generics Map #4431

Closed
vorburger opened this issue May 12, 2023 · 3 comments · Fixed by #4534
Closed

classDiagram Generics Map #4431

vorburger opened this issue May 12, 2023 · 3 comments · Fixed by #4534

Comments

@vorburger
Copy link
Contributor

Is your feature request related to a problem? Please describe.

On http://localhost:8000/concepts/core-arch/ I originally used this for generics in a Map:

classDiagram
  class Entity{
    Timestamp ts
    Map~String, String~ links
  }
Loading

which currently fails (also here on GitHub) with:

caught RangeError: Maximum call stack size exceeded
    at String.replace (<anonymous>)
    at Uk (common.ts:164:36)
    at Uk (common.ts:167:12)
    at Uk (common.ts:167:12)
    at Uk (common.ts:167:12)
    at Uk (common.ts:167:12)

I gathered with a bit trial and error that this is due to the , comma in Map~String, String~ (which I wrote like that coming from a Java-like Map<String, String> syntax).

I have worked around it by using a | instead of a , for now, so this works, but only if there are no spaces around it:

classDiagram
  class Entity{
    Timestamp ts
    Map~String|String~ links
  }
Loading

But perhaps you would like to consider permitting a comma as well? And spaces? (Perhaps even some other separate characters?)

@sidharthv96 sidharthv96 transferred this issue from mermaid-js/mermaid-live-editor May 26, 2023
@github-actions github-actions bot added the Status: Triage Needs to be verified, categorized, etc label May 26, 2023
@turtton
Copy link

turtton commented May 27, 2023

I also face the same issue.
It is a side note, but the same error occurs when you add spaces before and after the | symbol. I discovered this while expressing types similar to TypeScript.

classDiagram
class A {
~String | int~ value
}
Loading

@jgreywolf jgreywolf added Type: Enhancement New feature or request and removed enhancement labels Jun 7, 2023
@jakraft
Copy link

jakraft commented Jun 28, 2023

I hit into the same issue #4555. The only "true" workaround I know of is to avoid the tilde syntax entirely and use HTML-escaped angle brackets (&lt; and &gt;), however, this significantly reduces the readability of the diagram when viewing the plaintext. The better option, IMO, would be to replace the tilde syntax and just add support for angle brackets, which eliminates all ambiguities when parsing.

@jgreywolf
Copy link
Contributor

This should be resolved with PR #4534

@jgreywolf jgreywolf added Graph: Class Status: Awaiting PR and removed Status: Triage Needs to be verified, categorized, etc labels Aug 27, 2023
@jgreywolf jgreywolf linked a pull request Aug 27, 2023 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants