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

Annonations on classes from the mermaid example give syntax error in text #5089

Closed
Jarivanbakel opened this issue Nov 30, 2023 · 4 comments
Closed
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect

Comments

@Jarivanbakel
Copy link

Jarivanbakel commented Nov 30, 2023

Description

The following code gives a syntax errors in text.
Removing the line <<interface>> Shape makes it work.

Note: We've tested multiple versions of mermaid and they don't seem to work.

---
title: Class diagram
---

<pre class="mermaid">
classDiagram
class Shape
<<interface>> Shape
Shape : noOfVertices
Shape : draw()
</pre>
<script type="module">
    import mermaid from 'https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.esm.min.mjs';
</script>

Steps to reproduce

  1. Copy the code and paste it to an .md file
  2. Try to show the diagram on the web.

Screenshots

image

Code Sample

No response

Setup

  • Mermaid version:10.6.1 & 11.0.0-alpha.6
  • Browser and Version: Chrome Version 119.0.6045.161 (Official Build) (64-bit)

Suggested Solutions

No response

Additional Context

No response

@Jarivanbakel Jarivanbakel added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Nov 30, 2023
@Jarivanbakel
Copy link
Author

Jarivanbakel commented Dec 1, 2023

classDiagram
class Shape<Type>
Shape : noOfVertices
Shape : draw()

Using "<" or "> in the name definition also does not work.

Found workaround for using "<" and ">" in the name definition:

class Duck ["Duck &lt; Type &gt; "] {
+String beakColor
+swim()
+quack()
}

Should this be a separate issue?

@jgreywolf
Copy link
Contributor

< and > are explicitly not supported. Per the documentation use ~ syntax to denote types

@jgreywolf
Copy link
Contributor

Interesting. I am seeing syntax error if I put this code into a webpage as you have shown here.
But it does NOT fail on mermaid.live.
image

@Jarivanbakel
Copy link
Author

Closed the issue, guess the script was not up to date.

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