diff --git a/docs/syntax/entityRelationshipDiagram.md b/docs/syntax/entityRelationshipDiagram.md index e31a00eb2..69a280a49 100644 --- a/docs/syntax/entityRelationshipDiagram.md +++ b/docs/syntax/entityRelationshipDiagram.md @@ -135,6 +135,44 @@ erDiagram "This **is** _Markdown_" ``` +#### Optional Relationship Labels + +Starting from Mermaid version 11.11.0, the relationship label in ER diagrams is optional. You can define relationships without specifying a label, and the diagram will render correctly. + +For example, the following is valid: + +```mermaid-example +erDiagram + BOOK }|..|{ AUTHOR + BOOK }|..|{ GENRE + AUTHOR }|..|{ GENRE +``` + +```mermaid +erDiagram + BOOK }|..|{ AUTHOR + BOOK }|..|{ GENRE + AUTHOR }|..|{ GENRE +``` + +This will show the relationships between the entities without any labels on the connecting lines. + +You can still add a label if you want to describe the relationship: + +```mermaid-example +erDiagram + BOOK }|..|{ AUTHOR : written_by + BOOK }|..|{ GENRE : categorized_as + AUTHOR }|..|{ GENRE : specializes_in +``` + +```mermaid +erDiagram + BOOK }|..|{ AUTHOR : written_by + BOOK }|..|{ GENRE : categorized_as + AUTHOR }|..|{ GENRE : specializes_in +``` + ### Relationship Syntax The `relationship` part of each statement can be broken down into three sub-components: diff --git a/packages/mermaid/src/docs/syntax/entityRelationshipDiagram.md b/packages/mermaid/src/docs/syntax/entityRelationshipDiagram.md index f9ed8df9b..9687a6bf8 100644 --- a/packages/mermaid/src/docs/syntax/entityRelationshipDiagram.md +++ b/packages/mermaid/src/docs/syntax/entityRelationshipDiagram.md @@ -89,6 +89,30 @@ erDiagram "This **is** _Markdown_" ``` +#### Optional Relationship Labels + +Starting from Mermaid version 11.11.0, the relationship label in ER diagrams is optional. You can define relationships without specifying a label, and the diagram will render correctly. + +For example, the following is valid: + +```mermaid-example +erDiagram + BOOK }|..|{ AUTHOR + BOOK }|..|{ GENRE + AUTHOR }|..|{ GENRE +``` + +This will show the relationships between the entities without any labels on the connecting lines. + +You can still add a label if you want to describe the relationship: + +```mermaid-example +erDiagram + BOOK }|..|{ AUTHOR : written_by + BOOK }|..|{ GENRE : categorized_as + AUTHOR }|..|{ GENRE : specializes_in +``` + ### Relationship Syntax The `relationship` part of each statement can be broken down into three sub-components: