diff --git a/.changeset/short-seals-sort.md b/.changeset/short-seals-sort.md new file mode 100644 index 0000000000..db8309c7fe --- /dev/null +++ b/.changeset/short-seals-sort.md @@ -0,0 +1,5 @@ +--- +'mermaid': minor +--- + +feat: allow to put notes in namespaces on classDiagram diff --git a/Dockerfile b/Dockerfile index 7be53d24ea..fa8c467ad2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ USER 0:0 RUN corepack enable \ && corepack enable pnpm -RUN apk add --no-cache git~=2.43.4 \ +RUN apk add --no-cache git~=2.43 \ && git config --add --system safe.directory /mermaid ENV NODE_OPTIONS="--max_old_space_size=8192" diff --git a/cypress/integration/rendering/classDiagram-v2.spec.js b/cypress/integration/rendering/classDiagram-v2.spec.js index 0c5dbc04b0..f54768d9ae 100644 --- a/cypress/integration/rendering/classDiagram-v2.spec.js +++ b/cypress/integration/rendering/classDiagram-v2.spec.js @@ -562,6 +562,20 @@ class C13["With Città foreign language"] ` ); }); + it('should add notes in namespaces', function () { + imgSnapshotTest( + ` + classDiagram + note "This is a outer note" + note for C1 "This is a outer note for C1" + namespace Namespace1 { + note "This is a inner note" + note for C1 "This is a inner note for C1" + class C1 + } + ` + ); + }); it('should render a simple class diagram with no members', () => { imgSnapshotTest( ` diff --git a/cypress/integration/rendering/classDiagram-v3.spec.js b/cypress/integration/rendering/classDiagram-v3.spec.js index 626d6fcea4..7e8d2ff0a0 100644 --- a/cypress/integration/rendering/classDiagram-v3.spec.js +++ b/cypress/integration/rendering/classDiagram-v3.spec.js @@ -709,6 +709,20 @@ class C13["With Città foreign language"] ` ); }); + it('should add notes in namespaces', function () { + imgSnapshotTest( + ` + classDiagram + note "This is a outer note" + note for C1 "This is a outer note for C1" + namespace Namespace1 { + note "This is a inner note" + note for C1 "This is a inner note for C1" + class C1 + } + ` + ); + }); it('should render a simple class diagram with no members', () => { imgSnapshotTest( ` diff --git a/demos/classchart.html b/demos/classchart.html index 980ea5098d..baae6e2823 100644 --- a/demos/classchart.html +++ b/demos/classchart.html @@ -184,6 +184,7 @@
classDiagram namespace Company.Project.Module { @@ -240,6 +241,20 @@+Class diagram demos
Bike --> Square : "Logo Shape"
+ classDiagram + note "This is a outer note" + note for Class1 "This is a outer note for Class1" + namespace ns { + note "This is a inner note" + note for Class1 "This is a inner note for Class1" + class Class1 + class Class2 + } ++