mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-02 20:04:14 +01:00
Fix #6680: Support multiple stereotypes in class diagrams
This commit is contained in:
118
demos/multiple-annotations-test.html
Normal file
118
demos/multiple-annotations-test.html
Normal file
@@ -0,0 +1,118 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Multiple Annotations Test</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 20px;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
h1,
|
||||
h2 {
|
||||
color: #333;
|
||||
}
|
||||
.mermaid {
|
||||
background: white;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
padding: 20px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
.description {
|
||||
background: #e8f4fd;
|
||||
border-left: 4px solid #0066cc;
|
||||
padding: 10px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Multiple Annotations Test - Issue #6680 Fix</h1>
|
||||
|
||||
<div class="description">
|
||||
<strong>Testing:</strong> Multiple stereotypes/annotations should now render correctly using
|
||||
external and inline annotation methods.
|
||||
</div>
|
||||
|
||||
<h2>Baseline - no annotations</h2>
|
||||
<pre class="mermaid">
|
||||
classDiagram
|
||||
class Shape
|
||||
class Circle
|
||||
class Triangle
|
||||
</pre>
|
||||
|
||||
<h2>#0 Baseline - single annotation</h2>
|
||||
<pre class="mermaid">
|
||||
classDiagram
|
||||
class Shape
|
||||
class Circle
|
||||
class Triangle
|
||||
|
||||
<<injected>> Shape
|
||||
</pre>
|
||||
|
||||
<h2>Method 1: External/Next-line Annotations</h2>
|
||||
<div class="description">
|
||||
External annotations defined on the line after the class definition:
|
||||
</div>
|
||||
<pre class="mermaid">
|
||||
classDiagram
|
||||
class Shape
|
||||
<<interface>> <<injected>> Shape
|
||||
class Circle
|
||||
<<abstract>> <<serializable>> Circle
|
||||
class Triangle
|
||||
<<interface>> <<cached>> <<singleton>> Triangle
|
||||
</pre>
|
||||
|
||||
<h2>Method 2: Inline Annotations</h2>
|
||||
<div class="description">Inline annotations defined directly with the class definition:</div>
|
||||
<pre class="mermaid">
|
||||
classDiagram
|
||||
class Shape <<interface>> <<injected>>
|
||||
class Circle <<abstract>> <<serializable>>
|
||||
class Square <<service>> <<singleton>> <<cached>>
|
||||
class Triangle <<interface>> <<component>> <<transient>>
|
||||
</pre>
|
||||
|
||||
<h2>Method 3: Mixed Methods Test</h2>
|
||||
<div class="description">Combination of both external and inline annotation methods:</div>
|
||||
<pre class="mermaid">
|
||||
classDiagram
|
||||
class Component <<interface>> <<injected>>
|
||||
class Service
|
||||
<<abstract>> <<singleton>> Service
|
||||
class Repository <<dao>> <<cached>>
|
||||
class Controller
|
||||
<<rest>> <<secured>> Controller
|
||||
</pre>
|
||||
|
||||
<h2>Real-world Example</h2>
|
||||
<div class="description">A practical example with relationships and multiple annotations:</div>
|
||||
<pre class="mermaid">
|
||||
classDiagram
|
||||
class BaseService <<abstract>> <<injectable>>
|
||||
class UserService <<service>> <<singleton>>
|
||||
class UserRepository <<repository>> <<cached>>
|
||||
class UserController
|
||||
<<controller>> <<secured>> UserController
|
||||
|
||||
BaseService <|-- UserService
|
||||
UserService --> UserRepository
|
||||
UserController --> UserService
|
||||
</pre>
|
||||
|
||||
<script type="module">
|
||||
import mermaid from './mermaid.esm.mjs';
|
||||
mermaid.initialize({
|
||||
startOnLoad: true,
|
||||
theme: 'default',
|
||||
logLevel: 'debug',
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user