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 Generic type adds HTML if name of HTML element Video, Section #5634

Closed
elbakerino opened this issue Jul 9, 2024 · 3 comments
Closed
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect

Comments

@elbakerino
Copy link

elbakerino commented Jul 9, 2024

Description

Section and Video as generic type in classDiagram adds HTML tags.

Some like Img don't cause this error, not further tested which others cause errors.

Steps to reproduce

Add Video or Section as generic type.

Screenshots

grafik

Code Sample

classDiagram
    class Zebra{
      +List<Video> videos
    }
    class Tiger{
      +List<Section> section
    }
    class Lion{
      +List<Img> images
    }

Setup

  • Mermaid version: latest
  • Browser and Version: [Chrome, Edge, Firefox]

Suggested Solutions

No response

Additional Context

No response

@elbakerino elbakerino added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Jul 9, 2024
@Austin-Fulbright
Copy link
Contributor

Currently working on this. I think I found the issue. Once I make sure all the test suites are passing, I will make a PR.

@Austin-Fulbright
Copy link
Contributor

Hey I realized that instead of using <> to declare generics you should use the ~~ instead. so for your code example:

classDiagram
class Zebra{
+List

section
}
class Lion{
+List images
}

The correct code for your desired output would be:
classDiagram
class Zebra{
  +List~Video~ videos
}
class Tiger{
  +List~Section~ section
}
class Lion{
  +List~Img~ images
}

The problem is with the way that the code handles <> I can change it however I am not sure if the <> were ever meant to declare generics in the code. But I hope this helps for now.

@elbakerino
Copy link
Author

Thanks, yes tilde works! I've only read the first code at the docs:

Nested type declarations such as List<List<int>> are supported, ....

But that demonstrated "how it is shown" and not "how it is written", maybe in general something hard to explain to users - and i think i'll run into that often without a mermaid linter ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
Development

No branches or pull requests

2 participants