Cannot mark members as protected in classDiagram
See original GitHub issueAttempting to mark a member as protected in a class diagram by using the octothorpe (hash) character causes the graph to not render. I’m attempting this based on the classDiagram documentation.
Specifically, the following code:
classDiagram
class MyClass
MyClass : #mytest
Causes the following error:
Parse error on line 3:
...s MyClassMyClass : #mytest
----------------------^
Expecting 'NEWLINE', 'EOF', got 'PUNCTUATION'
The private, public and package qualifiers all seem to work appropriately.
This reproduces using the Mermaid Live Editor
I’m using Windows 10 with Chrome 78.0.3904.87
I can work around this cosmetically by using #35;
but it took me a while to figure that out. It’s unclear to me whether I lose any functionality by doing so. (I believe not.)
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
OOAD - UML Basic Notations - Tutorialspoint
Public − A public member is visible from anywhere in the system. In class diagram, it is prefixed by the symbol '+'. ·...
Read more >What does the '#' symbol mean in a UML class diagram?
It indicates a protected member of a class or other data type. - Indicates private. + Indicates public. # Indicates protected.
Read more >The UML 2 class diagram - IBM Developer
UML identifies four types of visibility: public, protected, private, and package.
Read more >UML Class Diagrams
A class diagram contains a rectangle for each class. ... This indicates that a Person object has private fields named name and birthDate,...
Read more >UML Class Diagram Tutorial - Visual Paradigm
Objects and classes go hand in hand. We can't talk about one without talking about the other. And the entire point of Object-Oriented...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I dont think you are inept. I would be surprised if this works, since it still starts with “#” which is defined as PUNCTUATION in the code 😃
I am going to continue looking into this, in my attempts to get a better understanding of the mermaid code. Maybe I can even contribute 😉
Interestingly, if you define the class with members inside of {}, this error does not happen. So it only appears to be when you are adding members individually
(Live Editor)