mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
192 lines
4.2 KiB
HTML
192 lines
4.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
<title>Architecture Mermaid Quick Test Page</title>
|
|
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=" />
|
|
<style>
|
|
div.mermaid {
|
|
/* font-family: 'trebuchet ms', verdana, arial; */
|
|
font-family: 'Courier New', Courier, monospace !important;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<h1>Architecture diagram demo</h1>
|
|
|
|
<h2>Simple diagram with groups</h2>
|
|
<pre class="mermaid">
|
|
architecture
|
|
group api[API]
|
|
|
|
service db(database)[Database] in api
|
|
service disk1(disk)[Storage] in api
|
|
service disk2(disk)[Storage] in api
|
|
service server(server)[Server] in api
|
|
service gateway(internet)[Gateway]
|
|
|
|
db L--R server
|
|
disk1 T--B server
|
|
disk2 T--B db
|
|
server T--B gateway
|
|
</pre>
|
|
<hr />
|
|
|
|
<h2>Groups within groups</h2>
|
|
<pre class="mermaid">
|
|
architecture
|
|
group api[API]
|
|
group public[Public API] in api
|
|
group private[Private API] in api
|
|
|
|
|
|
service serv1(server)[Server] in public
|
|
|
|
|
|
service serv2(server)[Server] in private
|
|
service db(database)[Database] in private
|
|
|
|
service gateway(internet)[Gateway] in api
|
|
|
|
serv1 B--T serv2
|
|
|
|
serv2 L--R db
|
|
|
|
serv1 L--R gateway
|
|
</pre>
|
|
<hr />
|
|
|
|
<h2>Default icon (?) from uknown icon name</h2>
|
|
<pre class="mermaid">
|
|
architecture
|
|
service unknown(iconnamedoesntexist)[Uknown Icon]
|
|
</pre>
|
|
<hr />
|
|
|
|
<h2>Split Direction</h2>
|
|
<pre class="mermaid">
|
|
architecture
|
|
service db(database)[Database]
|
|
service s3(disk)[Storage]
|
|
service serv1(server)[Server 1]
|
|
service serv2(server)[Server 2]
|
|
service disk(disk)[Disk]
|
|
|
|
db L--R s3
|
|
serv1 L--T s3
|
|
serv2 L--B s3
|
|
serv1 T--B disk
|
|
</pre>
|
|
<hr />
|
|
|
|
<h2>Arrow Tests</h2>
|
|
<pre class="mermaid">
|
|
architecture
|
|
service servC(server)[Server 1]
|
|
service servL(server)[Server 2]
|
|
service servR(server)[Server 3]
|
|
service servT(server)[Server 4]
|
|
service servB(server)[Server 5]
|
|
|
|
servC (L--R) servL
|
|
servC (R--L) servR
|
|
servC (T--B) servT
|
|
servC (B--T) servB
|
|
|
|
servL (T--L) servT
|
|
servL (B--L) servB
|
|
servR (T--R) servT
|
|
servR (B--R) servB
|
|
</pre>
|
|
<pre class="mermaid">
|
|
architecture
|
|
service servC(server)[Server 1]
|
|
service servL(server)[Server 2]
|
|
service servR(server)[Server 3]
|
|
service servT(server)[Server 4]
|
|
service servB(server)[Server 5]
|
|
|
|
servC (L--R) servL
|
|
servC (R--L) servR
|
|
servC (T--B) servT
|
|
servC (B--T) servB
|
|
|
|
servT (L--T) servL
|
|
servB (L--B) servL
|
|
servT (R--T) servR
|
|
servB (R--B) servR
|
|
</pre>
|
|
<hr />
|
|
|
|
<script type="module">
|
|
import mermaid from './mermaid.esm.mjs';
|
|
|
|
const ALLOWED_TAGS = [
|
|
'a',
|
|
'b',
|
|
'blockquote',
|
|
'br',
|
|
'dd',
|
|
'div',
|
|
'dl',
|
|
'dt',
|
|
'em',
|
|
'foreignObject',
|
|
'h1',
|
|
'h2',
|
|
'h3',
|
|
'h4',
|
|
'h5',
|
|
'h6',
|
|
'h7',
|
|
'h8',
|
|
'hr',
|
|
'i',
|
|
'li',
|
|
'ul',
|
|
'ol',
|
|
'p',
|
|
'pre',
|
|
'span',
|
|
'strike',
|
|
'strong',
|
|
'table',
|
|
'tbody',
|
|
'td',
|
|
'tfoot',
|
|
'th',
|
|
'thead',
|
|
'tr',
|
|
];
|
|
mermaid.parseError = function (err, hash) {
|
|
// console.error('Mermaid error: ', err);
|
|
};
|
|
mermaid.initialize({
|
|
theme: 'base',
|
|
startOnLoad: true,
|
|
logLevel: 0,
|
|
flowchart: {
|
|
useMaxWidth: false,
|
|
htmlLabels: true,
|
|
},
|
|
gantt: {
|
|
useMaxWidth: false,
|
|
},
|
|
architecture: {
|
|
iconSize: 80,
|
|
},
|
|
useMaxWidth: false,
|
|
});
|
|
function callback() {
|
|
alert('It worked');
|
|
}
|
|
mermaid.parseError = function (err, hash) {
|
|
console.error('In parse error:');
|
|
console.error(err);
|
|
};
|
|
</script>
|
|
</body>
|
|
</html>
|