diff --git a/demos/er.html b/demos/er.html
index f1233e19f..eabae6acf 100644
--- a/demos/er.html
+++ b/demos/er.html
@@ -112,12 +112,12 @@
erDiagram
- p as Person {
- string firstName
- string lastName
+ p[Person] {
+ string firstName
+ string lastName
}
- a as "Customer Account" {
- string email
+ a["Customer Account"] {
+ string email
}
p ||--o| a : has
diff --git a/docs/syntax/entityRelationshipDiagram.md b/docs/syntax/entityRelationshipDiagram.md
index 5bc8df436..ea3b8c005 100644
--- a/docs/syntax/entityRelationshipDiagram.md
+++ b/docs/syntax/entityRelationshipDiagram.md
@@ -200,15 +200,15 @@ The `type` values must begin with an alphabetic character and may contain digits
### Entity Name Aliases (v\+)
-An alias can be added to an entity using `as` keyword. If provided, the alias will be showed in the diagram instead of the entity name.
+An alias can be added to an entity using square brackets. If provided, the alias will be showed in the diagram instead of the entity name.
```mermaid-example
erDiagram
- p as Person {
+ p[Person] {
string firstName
string lastName
}
- a as "Customer Account" {
+ a["Customer Account"] {
string email
}
p ||--o| a : has
@@ -216,11 +216,11 @@ erDiagram
```mermaid
erDiagram
- p as Person {
+ p[Person] {
string firstName
string lastName
}
- a as "Customer Account" {
+ a["Customer Account"] {
string email
}
p ||--o| a : has
diff --git a/packages/mermaid/src/diagrams/er/parser/erDiagram.jison b/packages/mermaid/src/diagrams/er/parser/erDiagram.jison
index 843fd9910..ea8abc21a 100644
--- a/packages/mermaid/src/diagrams/er/parser/erDiagram.jison
+++ b/packages/mermaid/src/diagrams/er/parser/erDiagram.jison
@@ -35,6 +35,8 @@ accDescr\s*"{"\s* { this.begin("acc_descr_multili
[\n]+ /* nothing */
"}" { this.popState(); return 'BLOCK_STOP'; }
. return yytext[0];
+"[" return 'SQS';
+"]" return 'SQE';
"one or zero" return 'ZERO_OR_ONE';
"one or more" return 'ONE_OR_MORE';
@@ -62,7 +64,6 @@ o\{ return 'ZERO_OR_MORE';
\-\- return 'IDENTIFYING';
"to" return 'IDENTIFYING';
"optionally to" return 'NON_IDENTIFYING';
-"as" return 'ALIAS';
\.\- return 'NON_IDENTIFYING';
\-\. return 'NON_IDENTIFYING';
[A-Za-z][A-Za-z0-9\-_]* return 'ALPHANUM';
@@ -114,15 +115,15 @@ statement
}
| entityName BLOCK_START BLOCK_STOP { yy.addEntity($1); }
| entityName { yy.addEntity($1); }
- | entityName ALIAS entityName BLOCK_START attributes BLOCK_STOP
+ | entityName SQS entityName SQE BLOCK_START attributes BLOCK_STOP
{
/* console.log('detected block'); */
yy.addEntity($1, $3);
- yy.addAttributes($1, $5);
+ yy.addAttributes($1, $6);
/* console.log('handled block'); */
}
- | entityName ALIAS entityName BLOCK_START BLOCK_STOP { yy.addEntity($1, $3); }
- | entityName ALIAS entityName { yy.addEntity($1, $3); }
+ | entityName SQS entityName SQE BLOCK_START BLOCK_STOP { yy.addEntity($1, $3); }
+ | entityName SQS entityName SQE { yy.addEntity($1, $3); }
| title title_value { $$=$2.trim();yy.setAccTitle($$); }
| acc_title acc_title_value { $$=$2.trim();yy.setAccTitle($$); }
| acc_descr acc_descr_value { $$=$2.trim();yy.setAccDescription($$); }
diff --git a/packages/mermaid/src/diagrams/er/parser/erDiagram.spec.js b/packages/mermaid/src/diagrams/er/parser/erDiagram.spec.js
index c23e31876..a480e50e5 100644
--- a/packages/mermaid/src/diagrams/er/parser/erDiagram.spec.js
+++ b/packages/mermaid/src/diagrams/er/parser/erDiagram.spec.js
@@ -137,7 +137,7 @@ describe('when parsing ER diagram it...', function () {
it('can have an alias', function () {
const entity = 'foo';
const alias = 'bar';
- erDiagram.parser.parse(`erDiagram\n${entity} as "${alias}"\n`);
+ erDiagram.parser.parse(`erDiagram\n${entity}["${alias}"]\n`);
const entities = erDb.getEntities();
expect(entities.hasOwnProperty(entity)).toBe(true);
expect(entities[entity].alias).toBe(alias);
diff --git a/packages/mermaid/src/docs/syntax/entityRelationshipDiagram.md b/packages/mermaid/src/docs/syntax/entityRelationshipDiagram.md
index 71d91bab7..f2a5d5481 100644
--- a/packages/mermaid/src/docs/syntax/entityRelationshipDiagram.md
+++ b/packages/mermaid/src/docs/syntax/entityRelationshipDiagram.md
@@ -146,15 +146,15 @@ The `type` values must begin with an alphabetic character and may contain digits
### Entity Name Aliases (v+)
-An alias can be added to an entity using `as` keyword. If provided, the alias will be showed in the diagram instead of the entity name.
+An alias can be added to an entity using square brackets. If provided, the alias will be showed in the diagram instead of the entity name.
```mermaid-example
erDiagram
- p as Person {
+ p[Person] {
string firstName
string lastName
}
- a as "Customer Account" {
+ a["Customer Account"] {
string email
}
p ||--o| a : has