bpruitt-goddard / vscode-mermaid-syntax-highlight

Markdown syntax support for the Mermaid charting language
MIT License
98 stars 37 forks source link

`erDiagram` Relationship Aliases #93

Closed gvee-uk closed 1 year ago

gvee-uk commented 1 year ago

Can the highlighting support for erDiagram be extended to support the aliases for relationships, please?

The syntax support (see #54 and #67) at the moment is this:

Value (left) Value (right) Meaning
\|o o\| Zero or one
\|\| \|\| Exactly one
}o o{ Zero or more (no upper limit)
}\| \|{ One or more (no upper limit)

But aliases are also support for these symbols, such as:

Value (left) Value (right) Alias for
one or zero one or zero Zero or one
zero or one zero or one Zero or one
one or more one or more One or more

Full list of aliases is available in the documentation here.

Here's an example in action:

erDiagram
    CAR ||--o{ NAMED-DRIVER : allows
    PERSON ||--o{ NAMED-DRIVER : is
erDiagram
    CAR ||--o{ NAMED-DRIVER : allows
    PERSON ||--o{ NAMED-DRIVER : is

Is equivalent to

erDiagram
    CAR only one--zero or more NAMED-DRIVER : allows
    PERSON only one--zero or more NAMED-DRIVER : is
erDiagram
    CAR only one--zero or more NAMED-DRIVER : allows
    PERSON only one--zero or more NAMED-DRIVER : is