Skip to content

fix: syntax error in class diagrams with nested generics#7489

Closed
Sigmabrogz wants to merge 1 commit intomermaid-js:developfrom
Sigmabrogz:fix/classchart-demo-syntax
Closed

fix: syntax error in class diagrams with nested generics#7489
Sigmabrogz wants to merge 1 commit intomermaid-js:developfrom
Sigmabrogz:fix/classchart-demo-syntax

Conversation

@Sigmabrogz
Copy link

Summary

Fixes the syntax error when attempting to define a class with an inline nested generic type and inline type definitions in the classchart.html demo file.

Problem

Closes #7480

The parser threw a "Syntax error in text" message in the classchart.html demo. Specifically:

  • The parser could not handle the space-separated class alias on a single line.
  • The closing nested generics (~~) were misinterpreted as markdown strike-through tokens.
  • Method return types were missing colons (: T), violating the Langium parser requirements.

Solution

  • Changed class People List~List~Person~~ to a standard block definition.
  • Added a whitespace between nested tildes (~ ~) to prevent the strike-through tokenization error.
  • Added missing colons to method return types (+getItem() : T).

Testing

  • Modified the demo file as suggested in the issue.
  • The demo file's code is strictly HTML text that is parsed by Mermaid. This fixes the immediate syntax failure.

Checklist

  • Code builds without errors
  • Tests pass
  • Dependencies added to package.json

Closes mermaid-js#7480

- Changed inline class alias to standard block definition to fix parser error
- Added space between nested tildes to prevent strike-through misinterpretation
- Added missing colon to method return type to comply with Langium parser
@changeset-bot
Copy link

changeset-bot bot commented Mar 15, 2026

⚠️ No Changeset found

Latest commit: bd57234

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@netlify
Copy link

netlify bot commented Mar 15, 2026

Deploy Preview for mermaid-js ready!

Name Link
🔨 Latest commit bd57234
🔍 Latest deploy log https://app.netlify.com/projects/mermaid-js/deploys/69b62fe11587b9000867045b
😎 Deploy Preview https://deploy-preview-7489--mermaid-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added the Type: Bug / Error Something isn't working or is incorrect label Mar 15, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 15, 2026

Open in StackBlitz

@mermaid-js/examples

npm i https://pkg.pr.new/@mermaid-js/examples@7489

mermaid

npm i https://pkg.pr.new/mermaid@7489

@mermaid-js/layout-elk

npm i https://pkg.pr.new/@mermaid-js/layout-elk@7489

@mermaid-js/layout-tidy-tree

npm i https://pkg.pr.new/@mermaid-js/layout-tidy-tree@7489

@mermaid-js/mermaid-zenuml

npm i https://pkg.pr.new/@mermaid-js/mermaid-zenuml@7489

@mermaid-js/parser

npm i https://pkg.pr.new/@mermaid-js/parser@7489

@mermaid-js/tiny

npm i https://pkg.pr.new/@mermaid-js/tiny@7489

commit: bd57234

@codecov
Copy link

codecov bot commented Mar 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 3.52%. Comparing base (277c496) to head (bd57234).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           develop   #7489   +/-   ##
=======================================
  Coverage     3.52%   3.52%           
=======================================
  Files          509     508    -1     
  Lines        49790   49779   -11     
  Branches       785     785           
=======================================
  Hits          1754    1754           
+ Misses       48036   48025   -11     
Flag Coverage Δ
unit 3.52% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@argos-ci
Copy link

argos-ci bot commented Mar 15, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - Mar 15, 2026, 4:15 AM

@Sigmabrogz Sigmabrogz closed this Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug / Error Something isn't working or is incorrect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix: Syntax error in class diagrams with nested generics and inline type definitions

1 participant