Describe the bug
When a link declaration contains a class name that has not appeared before, Mermaid does not render the class. It also does not emit an error or warning.
To Reproduce
Steps to reproduce the behavior:
Create a class diagram with a link declaration for a class that does not appear anywhere else in the same Mermaid snippet.
Generate the Mermaid diagram and notice that the class is not generated at all. Also notice that there are no errors or warnings.
Expected behavior
Either:
An error message explaining that link declarations are only valid if their corresponding classes are declared separately (e.g. in a class declaration), plus inclusion of the dependency between link declarations and other declarations in the documentation, or
The existence of the class to be deduced from the link declaration.
I personally prefer variant (2) because it keeps the language and documentation simple. If declarations interact with one another in unnecessary ways this makes writing Mermaid diagrams more complex.
Code Sample
The following snippet renders an empty diagram:
classDiagram
link Animal "./#Animal"
The following snippet renders the intended diagram:
Describe the bug When a link declaration contains a class name that has not appeared before, Mermaid does not render the class. It also does not emit an error or warning.
To Reproduce Steps to reproduce the behavior:
Expected behavior Either:
I personally prefer variant (2) because it keeps the language and documentation simple. If declarations interact with one another in unnecessary ways this makes writing Mermaid diagrams more complex.
Code Sample The following snippet renders an empty diagram:
The following snippet renders the intended diagram:
Desktop: