Compare commits

..

6 Commits

Author SHA1 Message Date
Sidharth Vinod
af3bbdc591 Merge pull request #6894 from mermaid-js/changeset-release/master
Version Packages
2025-08-22 17:37:05 +05:30
github-actions[bot]
8813cf2c94 Version Packages 2025-08-22 09:03:57 +00:00
Sidharth Vinod
d145c0e910 Merge pull request #6890 from mermaid-js/develop
Pre Release
2025-08-22 14:31:33 +05:30
Shubham P
29886b8dd4 Merge pull request #6886 from mermaid-js/6721/Bidirectional-arrows--render-incorrectly-with-autonumber-in-sequence-diagrams
6721: Correct rendering of bidirectional arrows with auto number
2025-08-21 15:57:22 +00:00
darshanr0107
e0b45c2d2b chore: added changeset
on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
2025-08-21 19:15:30 +05:30
darshanr0107
d4c76968e9 fix: correct rendering of bidirectional arrows with autonumber
on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
2025-08-21 19:09:39 +05:30
10 changed files with 56 additions and 52 deletions

View File

@@ -1,5 +0,0 @@
---
'mermaid': patch
---
fix: Make relationship-label optional in ER diagrams

View File

@@ -322,18 +322,6 @@ ORDER ||--|{ LINE-ITEM : contains
);
});
it('should render an ER diagram without labels also', () => {
imgSnapshotTest(
`
erDiagram
BOOK }|..|{ AUTHOR
BOOK }|..|{ GENRE
AUTHOR }|..|{ GENRE
`,
{ logLevel: 1 }
);
});
it('should render relationship labels with line breaks', () => {
imgSnapshotTest(
`

View File

@@ -893,6 +893,17 @@ describe('Sequence diagram', () => {
}
);
});
it('should handle bidirectional arrows with autonumber', () => {
imgSnapshotTest(`
sequenceDiagram
autonumber
participant A
participant B
A<<->>B: This is a bidirectional message
A->B: This is a normal message`);
});
it('should support actor links and properties when not mirrored EXPERIMENTAL: USE WITH CAUTION', () => {
//Be aware that the syntax for "properties" is likely to be changed.
imgSnapshotTest(

View File

@@ -1,5 +1,11 @@
# mermaid
## 11.10.1
### Patch Changes
- [#6886](https://github.com/mermaid-js/mermaid/pull/6886) [`e0b45c2`](https://github.com/mermaid-js/mermaid/commit/e0b45c2d2b41c2a9038bf87646fa3ccd7560eb20) Thanks [@darshanr0107](https://github.com/darshanr0107)! - fix: Handle arrows correctly when auto number is enabled
## 11.10.0
### Minor Changes

View File

@@ -1,6 +1,6 @@
{
"name": "mermaid",
"version": "11.10.0",
"version": "11.10.1",
"description": "Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.",
"type": "module",
"module": "./dist/mermaid.core.mjs",

View File

@@ -94,22 +94,6 @@ start
: 'ER_DIAGRAM' document 'EOF' { /*console.log('finished parsing');*/ }
;
relationship
: ENTITY relationType ENTITY maybeRole
{
yy.addRelationship($1, $4, $3, $2);
};
maybeRole
: COLON role
{
$$ = $2;
}
| /* empty */
{
$$ = '';
};
document
: /* empty */ { $$ = [] }
| document line {$1.push($2);$$ = $1}
@@ -124,34 +108,32 @@ line
statement
: entityName relSpec entityName maybeRole
: entityName relSpec entityName COLON role
{
yy.addEntity($1);
yy.addEntity($3);
yy.addRelationship($1, $4, $3, $2);
yy.addRelationship($1, $5, $3, $2);
}
| entityName STYLE_SEPARATOR idList relSpec entityName STYLE_SEPARATOR idList maybeRole
| entityName STYLE_SEPARATOR idList relSpec entityName STYLE_SEPARATOR idList COLON role
{
yy.addEntity($1);
yy.addEntity($5);
yy.addRelationship($1, $8, $5, $4);
yy.addRelationship($1, $9, $5, $4);
yy.setClass([$1], $3);
yy.setClass([$5], $7);
}
| entityName STYLE_SEPARATOR idList relSpec entityName maybeRole
| entityName STYLE_SEPARATOR idList relSpec entityName COLON role
{
yy.addEntity($1);
yy.addEntity($5);
yy.addRelationship($1, $6, $5, $4);
yy.addRelationship($1, $7, $5, $4);
yy.setClass([$1], $3);
}
| entityName relSpec entityName STYLE_SEPARATOR idList maybeRole
| entityName relSpec entityName STYLE_SEPARATOR idList COLON role
{
yy.addEntity($1);
yy.addEntity($3);
yy.addRelationship($1, $6, $3, $2);
yy.addRelationship($1, $7, $3, $2);
yy.setClass([$3], $5);
}
| entityName BLOCK_START attributes BLOCK_STOP

View File

@@ -981,12 +981,6 @@ describe('when parsing ER diagram it...', function () {
expect(rels[0].roleA).toBe('places');
});
it('should allow label as optional', function () {
erDiagram.parser.parse('erDiagram\nCUSTOMER ||--|{ ORDER');
const rels = erDb.getRelationships();
expect(rels[0].roleA).toBe('');
});
it('should represent parent-child relationship correctly', function () {
erDiagram.parser.parse('erDiagram\nPROJECT u--o{ TEAM_MEMBER : "parent"');
const rels = erDb.getRelationships();

View File

@@ -476,7 +476,29 @@ const drawMessage = async function (diagram, msgModel, lineStartY: number, diagO
// add node number
if (sequenceVisible || conf.showSequenceNumbers) {
line.attr('marker-start', 'url(' + url + '#sequencenumber)');
const isBidirectional =
type === diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID ||
type === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED;
if (isBidirectional) {
const SEQUENCE_NUMBER_RADIUS = 6;
if (startx < stopx) {
line.attr('x1', startx + 2 * SEQUENCE_NUMBER_RADIUS);
} else {
line.attr('x1', startx + SEQUENCE_NUMBER_RADIUS);
}
}
diagram
.append('line')
.attr('x1', startx)
.attr('y1', lineStartY)
.attr('x2', startx)
.attr('y2', lineStartY)
.attr('stroke-width', 0)
.attr('marker-start', 'url(' + url + '#sequencenumber)');
diagram
.append('text')
.attr('x', startx)

View File

@@ -1,5 +1,11 @@
# mermaid
## 11.10.1
### Patch Changes
- [#6886](https://github.com/mermaid-js/mermaid/pull/6886) [`e0b45c2`](https://github.com/mermaid-js/mermaid/commit/e0b45c2d2b41c2a9038bf87646fa3ccd7560eb20) Thanks [@darshanr0107](https://github.com/darshanr0107)! - fix: Handle arrows correctly when auto number is enabled
## 11.10.0
### Minor Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@mermaid-js/tiny",
"version": "11.10.0",
"version": "11.10.1",
"description": "Tiny version of mermaid",
"type": "commonjs",
"main": "./dist/mermaid.tiny.js",