mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
https://mermaid.js.org
MIT License
72.8k stars 6.65k forks source link

dot character in ERD #1895

Closed ozum closed 2 years ago

ozum commented 3 years ago

I can't use dot character (.) in ERD diagrams.

To Reproduce Open live editor and put code below:

erDiagram
  public.product ||--o{ public.product_color : label

or

erDiagram
  "public.product" ||--o{ "public.product_color" : label

Got error:

Parse error on line 2:
erDiagram  "public.product" ||-
-----------^
Expecting 'EOF', 'SPACE', 'NEWLINE', 'ALPHANUM', 'open_directive', got 'WORD'

Expected behavior I expected using quotes around text solve the problem.

zomgbre commented 1 year ago

This appears to still be an issue. :( I'm looking to diagram MongoDB style model which can have nested entities.

jcdang commented 1 year ago

I think @weedySeaDragon could speak more on this but it seems like this feature has been removed

https://github.com/jcdang/mermaid/commit/4bedc49b4dc3575c068432b5d90292ad4ab57494 https://github.com/jcdang/mermaid/commit/3c1bad17925af484949e6c0eb91981ba36cfb2f5

@ozum has mentioned "public.product" ||--o{ "public.product_color" : label works

I think the approach going forward is to use AS alias but it still has an issue.

erDiagram
  public_product AS "public.product" {
  }
  public_product_color AS "public.product_color" {
  }
  public_product ||--o{ public_product_color : label
weedySeaDragon commented 1 year ago

I checked the code:

@jcdang and @zomgbre - If you need something else (like spaces or other characters in the attributes), I encourage you to submit a feature request.

jcdang commented 1 year ago

Thanks for the response @weedySeaDragon. Do these features need to go through some roadmap acceptance process? I would like to help but I would need to know the syntax direction so I can make appropriate changes to the grammar. I've seen multiple ways of doing aliases in mermaid and I believe it would make things easier to have a consistent escape pattern to have this feature done across all diagram models.

weedySeaDragon commented 1 year ago

@jcdang I agree that having standardized ( and DRY) grammar parts would be helpful. I know that work is being done to use langium and to pull out those common and standardized parts. And also that backward compatibility is important.
Issue #4401 has the overview and initial discussions. Look at the linked/referenced issues and PRs to see initial work.

There is a core goup of contributors that will review proposed implementations. You can open up an issue and describe a proposed solution and when that is reviewed, your solution can be discussed.