mermaid icon indicating copy to clipboard operation
mermaid copied to clipboard

Allow entity type names to contain spaces, punctuation and other characters

Open sualeh opened this issue 4 years ago • 5 comments

Describe the solution you'd like Allow entity types to have names in double-quotes, so that they can contain spaces, punctuation and other characters. This way, database table names with space separators can be represented better.

Additional context This may not be the theoretically "correct" way to name entity types, but practically, we see a lot of examples where people use ER diagrams to represent relational schemas (rather than trying to represent the underlying ER model). Allowing entity type names to contain spaces, punctuation and other characters will expand the user base of mermaid ER diagrams.

sualeh avatar Jul 16 '20 02:07 sualeh

This would also allow representing arrays like this: string[] which I believe is not even possible now 🤔

IchordeDionysos avatar Nov 10 '21 19:11 IchordeDionysos

It is now possible to have entity names with a space by wrapping it in double quotes. However; this does not work for field types or names because the parser erroneously assumes text wrapped in quotes is a comment.

image

In other words, "CUSTOMER TABLE" renders properly, but the "varchar(250)" and "Custom Field" throw a parsing error.

image

We display two versions of an ERD, one with physical names and the other with logical names. Currently we have to modify the resulting SVG text nodes programmatically to display logical names. While this hack works on websites, it's useless in environments where we cannot control this (i.e. in a Github README).

coreybutler avatar Jan 13 '23 06:01 coreybutler

Any updates?

AhmedThahir avatar Jan 21 '24 10:01 AhmedThahir

I don't know how you folks see this. I feel like not allowing punctuation in a class name is a show stopper. image image What can I do about it?

michimussato avatar May 28 '24 02:05 michimussato

Apparently, backticking the class name gives me the desired result:

5

[...]
class `some.modules.Class` {
   processNestedSchemas(self) 
}
[...]
node10  -->  `some.modules.Class`
`some.modules.Class`  -->  node9 
`some.modules.Class`  -->  node3 
node10  -->  node7 
`some.modules.Class`  -->  node8 

michimussato avatar Jun 18 '24 04:06 michimussato