Skip to content

feat: allow to put notes in namespaces on classDiagram - #5814

Merged
jgreywolf merged 19 commits into
mermaid-js:developfrom
kairi003:feature/4706_allow_notes_in_namespace
Oct 27, 2025
Merged

jgreywolf merged 19 commits into
mermaid-js:developfrom
kairi003:feature/4706_allow_notes_in_namespace

Conversation

@kairi003

@kairi003 kairi003 commented Sep 2, 2024 •

Copy link
Copy Markdown
Contributor

📑 Summary

It improve its support for notes inside namespaces.

Resolves #4706

image

📏 Design Decisions

It allows NoteNode to be added in the namespace.

  • classStatements parses not only classStatement but also noteStatement and returns an array of their IDs.
  • addClassesToNamespace() takes a new param noteNames and associates the namespace with the note.
  • In classRender-v2.ts addNotes() implements the process of adding to namespace like addClasses().
  • Changed notes from Array to ClassNoteMap.
  • Add fields to ClassNote.
    • parent: keeps the ID of the namespace.
    • index: holds the number of the note. index: holds the number of the note (used as a reference when generating the edge ID)

📋 Tasks

Make sure you

  • 📖 have read the contribution guidelines
  • 💻 have added necessary unit/e2e tests.
  • 📓 have added documentation. Make sure MERMAID_RELEASE_VERSION is used for all new features.
  • 🦋 If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

@changeset-bot

changeset-bot Bot commented Sep 2, 2024 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 700aa10

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
mermaid Minor

Not sure what this means? Click here to learn what changesets are.

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

@github-actions github-actions Bot added the Type: Enhancement New feature or request label Sep 2, 2024
@netlify

netlify Bot commented Sep 2, 2024 •

Copy link
Copy Markdown

✅ Deploy Preview for mermaid-js ready!

Name Link
🔨 Latest commit d60b09c
🔍 Latest deploy log https://app.netlify.com/sites/mermaid-js/deploys/674babdadac1410008c9f944
😎 Deploy Preview https://deploy-preview-5814--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 site configuration.

@codecov

codecov Bot commented Sep 2, 2024 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 109 lines in your changes missing coverage. Please review.
✅ Project coverage is 3.55%. Comparing base (fed8a52) to head (700aa10).
⚠️ Report is 20 commits behind head on develop.

Files with missing lines Patch % Lines
packages/mermaid/src/diagrams/class/classDb.ts 0.00% 56 Missing ⚠️
...ges/mermaid/src/diagrams/class/classRenderer-v2.ts 0.00% 52 Missing ⚠️
...ckages/mermaid/src/diagrams/class/classRenderer.js 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           develop   #5814      +/-   ##
==========================================
- Coverage     3.55%   3.55%   -0.01%     
==========================================
  Files          473     473              
  Lines        47480   47498      +18     
  Branches       730     730              
==========================================
  Hits          1687    1687              
- Misses       45793   45811      +18     
Flag Coverage Δ
unit 3.55% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/mermaid/src/diagrams/class/classTypes.ts 0.00% <ø> (ø)
...ckages/mermaid/src/diagrams/class/classRenderer.js 0.00% <0.00%> (ø)
...ges/mermaid/src/diagrams/class/classRenderer-v2.ts 0.36% <0.00%> (-0.02%) ⬇️
packages/mermaid/src/diagrams/class/classDb.ts 0.00% <0.00%> (ø)
🚀 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

argos-ci Bot commented Sep 2, 2024 •

Copy link
Copy Markdown

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

Build Status Details Updated (UTC)
default (Inspect) 👍 Changes approved 2 added Oct 25, 2025, 7:33 PM

@kairi003
kairi003 force-pushed the feature/4706_allow_notes_in_namespace branch from c8a41d6 to fc0c793 Compare September 3, 2024 06:28
@kairi003 kairi003 changed the title Feature/4706 allow notes in namespace feat: allow notes in namespace Sep 7, 2024
@pkg-pr-new

pkg-pr-new Bot commented Sep 7, 2024 •

Copy link
Copy Markdown

Open in StackBlitz

@mermaid-js/examples

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

mermaid

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

@mermaid-js/layout-elk

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

@mermaid-js/layout-tidy-tree

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

@mermaid-js/mermaid-zenuml

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

@mermaid-js/parser

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

@mermaid-js/tiny

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

commit: 700aa10

@kairi003 kairi003 changed the title feat: allow notes in namespace feat: allow to put notes in namespace on classDiagram Sep 7, 2024
@kairi003 kairi003 changed the title feat: allow to put notes in namespace on classDiagram feat: allow to put notes in namespaces on classDiagram Sep 7, 2024
@jgreywolf

Copy link
Copy Markdown
Contributor

@kairi003 please resolve the conflicts, then I will review

@kairi003

kairi003 commented Nov 8, 2024 •

Copy link
Copy Markdown
Contributor Author

@jgreywolf
Sorry, it will take some time to resolve the conflict.
I must understand the new classRenderer-v3 by #5880 and re-implement this PR.

@kairi003
kairi003 force-pushed the feature/4706_allow_notes_in_namespace branch from dbc04be to ab58538 Compare November 9, 2024 17:11
@kairi003

kairi003 commented Nov 9, 2024

Copy link
Copy Markdown
Contributor Author

@jgreywolf
Thank you very much for your patience.
I have successfully resolved the conflicts and merged the features.
Could you review it?

@kairi003
kairi003 force-pushed the feature/4706_allow_notes_in_namespace branch from ec7c7b6 to 25c43fa Compare November 9, 2024 17:36
Comment thread packages/mermaid/src/diagrams/class/classDb.ts Outdated
Comment thread packages/mermaid/src/diagrams/class/parser/classDiagram.jison
@The-Alchemist

Copy link
Copy Markdown
Contributor

Looks like the tests are failing, but not because of any code issues but because of a timeout:

Error: You have reached the maximum screenshot capacity included in your Pro open source xl Plan. Please upgrade your Plan.
    at throwAPIError (file:///__w/mermaid/mermaid/node_modules/.pnpm/@argos-ci+api-client@0.5.0/node_modules/@argos-ci/api-client/dist/index.mjs:28:15)
    at upload (file:///__w/mermaid/mermaid/node_modules/.pnpm/@argos-ci+core@2.8.1/node_modules/@argos-ci/core/dist/index.mjs:886:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.<anonymous> (file:///__w/mermaid/mermaid/node_modules/.pnpm/@argos-ci+cypress@2.2.2_cypress@13.15.0/node_modules/@argos-ci/cypress/dist/task.mjs:32:21)
    at async Object.handlerThatCallsUserDefinedHandler [as handler] (/__w/mermaid/mermaid/node_modules/.pnpm/@applitools+eyes-cypress@3.44.9_encoding@0.1.13_typescript@5.4.5/node_modules/@applitools/eyes-cypress/dist/plugin/pluginExport.js:105:21)
Test run failed, code 1

https://github.com/mermaid-js/mermaid/actions/runs/11872956086/job/33087297356?pr=5814

@kairi003
kairi003 force-pushed the feature/4706_allow_notes_in_namespace branch from 21ce35c to 875827f Compare November 20, 2024 22:18
@kairi003

kairi003 commented Nov 20, 2024 •

Copy link
Copy Markdown
Contributor Author

Looks like the tests are failing, but not because of any code issues but because of a timeout:

Error: You have reached the maximum screenshot capacity included in your Pro open source xl Plan. Please upgrade your Plan.
    at throwAPIError (file:///__w/mermaid/mermaid/node_modules/.pnpm/@argos-ci+api-client@0.5.0/node_modules/@argos-ci/api-client/dist/index.mjs:28:15)
    at upload (file:///__w/mermaid/mermaid/node_modules/.pnpm/@argos-ci+core@2.8.1/node_modules/@argos-ci/core/dist/index.mjs:886:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.<anonymous> (file:///__w/mermaid/mermaid/node_modules/.pnpm/@argos-ci+cypress@2.2.2_cypress@13.15.0/node_modules/@argos-ci/cypress/dist/task.mjs:32:21)
    at async Object.handlerThatCallsUserDefinedHandler [as handler] (/__w/mermaid/mermaid/node_modules/.pnpm/@applitools+eyes-cypress@3.44.9_encoding@0.1.13_typescript@5.4.5/node_modules/@applitools/eyes-cypress/dist/plugin/pluginExport.js:105:21)
Test run failed, code 1

https://github.com/mermaid-js/mermaid/actions/runs/11872956086/job/33087297356?pr=5814

Note that the last non-merge commit is 70f679d, which passes the required tests.
Only argos-ci seems to fail, but this is due to the addition of a new e2e test case.

https://app.argos-ci.com/mermaid/mermaid/builds/2448/118222601

@kairi003

Copy link
Copy Markdown
Contributor Author

https://github.com/marketplace/argos-ci
The screenshot capacity of argos-ci is reset monthly. e2e test should be re-run after the month changes.

@kairi003

kairi003 commented Dec 1, 2024

Copy link
Copy Markdown
Contributor Author

it requres #6102 to pass e2e test, i think

@jgreywolf

Copy link
Copy Markdown
Contributor

@sidharthv96 @knsv @ashishjain0512 @aloisklink
Can one of you help with the test failing issue here?

@jgreywolf

Copy link
Copy Markdown
Contributor

I believe this is one of the steps that a PR of mine is failing at as well

@The-Alchemist

Copy link
Copy Markdown
Contributor

Is there a way to re-trigger the build? I can resolve the conflicts once that's done.

@netlify

netlify Bot commented Oct 25, 2025 •

Copy link
Copy Markdown

✅ Deploy Preview for mermaid-js ready!

Name Link
🔨 Latest commit 700aa10
🔍 Latest deploy log https://app.netlify.com/projects/mermaid-js/deploys/68fd228572b0f0000890b992
😎 Deploy Preview https://deploy-preview-5814--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.

@kairi003
kairi003 force-pushed the feature/4706_allow_notes_in_namespace branch from e60bfff to 700aa10 Compare October 25, 2025 19:18
@kairi003

Copy link
Copy Markdown
Contributor Author

@jgreywolf @The-Alchemist Hi, I've fixed the conflicts and updated code to match the changes of develop branch.

@kairi003

Copy link
Copy Markdown
Contributor Author

The status of argos ci being “fails” is because new screenshots were added; it is not an error.

@jgreywolf
jgreywolf added this pull request to the merge queue Oct 27, 2025
Merged via the queue into mermaid-js:develop with commit 9af985b Oct 27, 2025
23 checks passed
@ThorstenStubbe

Copy link
Copy Markdown

When does this fix comes into release?

This was referenced Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

class diagrams: allow notes for namespace'd classes

4 participants