mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
Merge branch 'master' into develop
This commit is contained in:
commit
6b251de227
@ -1,6 +0,0 @@
|
|||||||
version: 2
|
|
||||||
snapshot:
|
|
||||||
widths:
|
|
||||||
- 1280
|
|
||||||
discovery:
|
|
||||||
disable-cache: true
|
|
@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"ecmaVersion": 6,
|
|
||||||
"libs": ["browser"],
|
|
||||||
"loadEagerly": [],
|
|
||||||
"dontLoad": ["node_modules/**"],
|
|
||||||
"plugins": {
|
|
||||||
"modules": {},
|
|
||||||
"es_modules": {},
|
|
||||||
"node": {},
|
|
||||||
"doc_comment": {
|
|
||||||
"fullDocs": true,
|
|
||||||
"strong": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -62,12 +62,6 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions)
|
|||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
entryFileNames: `${name}.esm${minify ? '.min' : ''}.mjs`,
|
entryFileNames: `${name}.esm${minify ? '.min' : ''}.mjs`,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name,
|
|
||||||
format: 'umd',
|
|
||||||
sourcemap: true,
|
|
||||||
entryFileNames: `${name}${minify ? '.min' : ''}.js`,
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if (core) {
|
if (core) {
|
||||||
|
@ -1,27 +1,20 @@
|
|||||||
import express, { NextFunction, Request, Response } from 'express';
|
import express from 'express';
|
||||||
|
import cors from 'cors';
|
||||||
import { createServer as createViteServer } from 'vite';
|
import { createServer as createViteServer } from 'vite';
|
||||||
|
|
||||||
const cors = (req: Request, res: Response, next: NextFunction) => {
|
|
||||||
res.header('Access-Control-Allow-Origin', '*');
|
|
||||||
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
|
|
||||||
res.header('Access-Control-Allow-Headers', 'Content-Type');
|
|
||||||
|
|
||||||
next();
|
|
||||||
};
|
|
||||||
|
|
||||||
async function createServer() {
|
async function createServer() {
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
// Create Vite server in middleware mode
|
// Create Vite server in middleware mode
|
||||||
const vite = await createViteServer({
|
const vite = await createViteServer({
|
||||||
configFile: './vite.config.ts',
|
configFile: './vite.config.ts',
|
||||||
|
mode: 'production',
|
||||||
server: { middlewareMode: true },
|
server: { middlewareMode: true },
|
||||||
appType: 'custom', // don't include Vite's default HTML handling middlewares
|
appType: 'custom', // don't include Vite's default HTML handling middlewares
|
||||||
});
|
});
|
||||||
|
|
||||||
app.use(cors);
|
app.use(cors());
|
||||||
app.use(express.static('./packages/mermaid/dist'));
|
app.use(express.static('./packages/mermaid/dist'));
|
||||||
// app.use(express.static('./packages/mermaid-example-diagram/dist'));
|
|
||||||
app.use(express.static('./packages/mermaid-example-diagram/dist'));
|
app.use(express.static('./packages/mermaid-example-diagram/dist'));
|
||||||
app.use(vite.middlewares);
|
app.use(vite.middlewares);
|
||||||
app.use(express.static('demos'));
|
app.use(express.static('demos'));
|
||||||
|
@ -1,5 +1,58 @@
|
|||||||
# A collection of updates that change the behaviour
|
# A collection of updates that change the behavior
|
||||||
|
|
||||||
|
## Async
|
||||||
|
|
||||||
|
`parse`, `render` are now async.
|
||||||
|
|
||||||
## Lazy loading and asynchronisity
|
## Lazy loading and asynchronisity
|
||||||
|
|
||||||
- Invalid dates are rendered as syntax error instead of returning best guess or the current date
|
- Invalid dates are rendered as syntax error instead of returning best guess or the current date
|
||||||
|
|
||||||
|
## ParseError is removed
|
||||||
|
|
||||||
|
```js
|
||||||
|
//< v10.0.0
|
||||||
|
mermaid.parse(text, parseError);
|
||||||
|
|
||||||
|
//>= v10.0.0
|
||||||
|
await mermaid.parse(text).catch(parseError);
|
||||||
|
// or
|
||||||
|
try {
|
||||||
|
await mermaid.parse(text);
|
||||||
|
} catch (err) {
|
||||||
|
parseError(err);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Init deprecated and InitThrowsErrors removed
|
||||||
|
|
||||||
|
The config passed to `init` was not being used eariler.
|
||||||
|
It will now be used.
|
||||||
|
The `init` function is deprecated and will be removed in the next major release.
|
||||||
|
init currently works as a wrapper to `initialize` and `run`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
//< v10.0.0
|
||||||
|
mermaid.init(config, selector, cb);
|
||||||
|
|
||||||
|
//>= v10.0.0
|
||||||
|
mermaid.initialize(config);
|
||||||
|
mermaid.run({
|
||||||
|
querySelector: selector,
|
||||||
|
postRenderCallback: cb,
|
||||||
|
suppressErrors: true,
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
//< v10.0.0
|
||||||
|
mermaid.initThrowsErrors(config, selector, cb);
|
||||||
|
|
||||||
|
//>= v10.0.0
|
||||||
|
mermaid.initialize(config);
|
||||||
|
mermaid.run({
|
||||||
|
querySelector: selector,
|
||||||
|
postRenderCallback: cb,
|
||||||
|
suppressErrors: false,
|
||||||
|
});
|
||||||
|
```
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util';
|
||||||
|
|
||||||
describe('Flowchart ELK', () => {
|
describe.skip('Flowchart ELK', () => {
|
||||||
it('1-elk: should render a simple flowchart', () => {
|
it('1-elk: should render a simple flowchart', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`flowchart-elk TD
|
`flowchart-elk TD
|
||||||
|
@ -670,6 +670,17 @@ title: Simple flowchart
|
|||||||
---
|
---
|
||||||
flowchart TD
|
flowchart TD
|
||||||
A --> B
|
A --> B
|
||||||
|
`,
|
||||||
|
{ titleTopMargin: 0 }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('3192: It should be possieble to render flowcharts with invisible edges', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`---
|
||||||
|
title: Simple flowchart with invisible edges
|
||||||
|
---
|
||||||
|
flowchart TD
|
||||||
|
A ~~~ B
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
|
@ -116,7 +116,11 @@ context('Sequence diagram', () => {
|
|||||||
loop Loopy
|
loop Loopy
|
||||||
Bob->>Alice: Pasten
|
Bob->>Alice: Pasten
|
||||||
end `,
|
end `,
|
||||||
{ wrap: true }
|
{
|
||||||
|
sequence: {
|
||||||
|
wrap: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
context('font settings', () => {
|
context('font settings', () => {
|
||||||
|
@ -49,13 +49,9 @@ mermaid.initialize({
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
mermaid.render(
|
void (async () => {
|
||||||
'the-id-of-the-svg',
|
const { svg } = await mermaid.render('the-id-of-the-svg', code);
|
||||||
code,
|
|
||||||
(svg) => {
|
|
||||||
console.log(svg);
|
console.log(svg);
|
||||||
const elem = document.querySelector('#graph-to-be');
|
const elem = document.querySelector('#graph-to-be');
|
||||||
elem.innerHTML = svg;
|
elem.innerHTML = svg;
|
||||||
}
|
})();
|
||||||
// ,document.querySelector('#tmp')
|
|
||||||
);
|
|
||||||
|
@ -113,8 +113,8 @@ classE o-- classF : aggregation
|
|||||||
callback Shape "callbackFunction" "This is a tooltip for a callback"
|
callback Shape "callbackFunction" "This is a tooltip for a callback"
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
|
@ -125,7 +125,6 @@
|
|||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
|
||||||
<script>
|
<script>
|
||||||
function clickByFlow(elemName) {
|
function clickByFlow(elemName) {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
@ -162,6 +161,9 @@
|
|||||||
|
|
||||||
document.getElementsByTagName('body')[0].appendChild(div);
|
document.getElementsByTagName('body')[0].appendChild(div);
|
||||||
}
|
}
|
||||||
|
</script>
|
||||||
|
<script type="module">
|
||||||
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({ startOnLoad: true, securityLevel: 'loose', logLevel: 1 });
|
mermaid.initialize({ startOnLoad: true, securityLevel: 'loose', logLevel: 1 });
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
@ -59,8 +59,8 @@
|
|||||||
Add another diagram to demo page : 48h
|
Add another diagram to demo page : 48h
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
function clickByFlow(elemName) {
|
function clickByFlow(elemName) {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
div.className = 'created-by-click';
|
div.className = 'created-by-click';
|
||||||
|
@ -125,8 +125,8 @@
|
|||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
function clickByFlow(elemName) {
|
function clickByFlow(elemName) {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
div.className = 'created-by-click';
|
div.className = 'created-by-click';
|
||||||
|
@ -61,8 +61,8 @@
|
|||||||
Add another diagram to demo page : 48h
|
Add another diagram to demo page : 48h
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
function clickByFlow(elemName) {
|
function clickByFlow(elemName) {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
div.className = 'created-by-click';
|
div.className = 'created-by-click';
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
end
|
end
|
||||||
A --> B
|
A --> B
|
||||||
</pre>
|
</pre>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
function showFullFirstSquad(elemName) {
|
function showFullFirstSquad(elemName) {
|
||||||
console.log('show ' + elemName);
|
console.log('show ' + elemName);
|
||||||
}
|
}
|
||||||
|
@ -107,8 +107,8 @@ Note over Alice,Bob: Looks
|
|||||||
Note over Bob,Alice: Looks back
|
Note over Bob,Alice: Looks back
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
|
@ -1,32 +1,12 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<!-- <meta charset="iso-8859-15"/> -->
|
|
||||||
<script src="./viewer.js" type="module"></script>
|
<script src="./viewer.js" type="module"></script>
|
||||||
<!-- <link href="https://fonts.googleapis.com/css?family=Mansalva&display=swap" rel="stylesheet" /> -->
|
|
||||||
<link
|
<link
|
||||||
href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap"
|
href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap"
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
/>
|
/>
|
||||||
<style>
|
<style>
|
||||||
body {
|
|
||||||
/* font-family: 'Mansalva', cursive;*/
|
|
||||||
/* font-family: 'Mansalva', cursive; */
|
|
||||||
/* font-family: 'arial'; */
|
|
||||||
/* font-family: "trebuchet ms", verdana, arial; */
|
|
||||||
}
|
|
||||||
/* div {
|
|
||||||
font-family: 'arial';
|
|
||||||
} */
|
|
||||||
/* .mermaid-main-font {
|
|
||||||
font-family: "trebuchet ms", verdana, arial;
|
|
||||||
font-family: var(--mermaid-font-family);
|
|
||||||
} */
|
|
||||||
/* :root {
|
|
||||||
--mermaid-font-family: '"trebuchet ms", verdana, arial';
|
|
||||||
--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive;
|
|
||||||
--mermaid-font-family: '"Lucida Console", Monaco, monospace';
|
|
||||||
} */
|
|
||||||
svg {
|
svg {
|
||||||
border: 2px solid darkred;
|
border: 2px solid darkred;
|
||||||
}
|
}
|
||||||
@ -36,21 +16,5 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body></body>
|
||||||
<!-- <script src="./mermaid.js"></script> -->
|
|
||||||
<script>
|
|
||||||
// Notice startOnLoad=false
|
|
||||||
// This prevents default handling in mermaid from render before the e2e logic is applied
|
|
||||||
// mermaid.initialize({
|
|
||||||
// startOnLoad: false,
|
|
||||||
// useMaxWidth: true,
|
|
||||||
// // "themeCSS": ":root { --mermaid-font-family: \"trebuchet ms\", verdana, arial;}",
|
|
||||||
// // fontFamily: '\"trebuchet ms\", verdana, arial;'
|
|
||||||
// // fontFamily: '"Comic Sans MS", "Comic Sans", cursive'
|
|
||||||
// // fontFamily: '"Mansalva", cursive',
|
|
||||||
// // fontFamily: '"Noto Sans SC", sans-serif'
|
|
||||||
// fontFamily: '"Noto Sans SC", sans-serif'
|
|
||||||
// });
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -17,7 +17,7 @@ example-diagram
|
|||||||
|
|
||||||
await mermaid.registerExternalDiagrams([exampleDiagram]);
|
await mermaid.registerExternalDiagrams([exampleDiagram]);
|
||||||
await mermaid.initialize({ logLevel: 0 });
|
await mermaid.initialize({ logLevel: 0 });
|
||||||
await mermaid.initThrowsErrorsAsync();
|
await mermaid.run();
|
||||||
if (window.Cypress) {
|
if (window.Cypress) {
|
||||||
window.rendered = true;
|
window.rendered = true;
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
click a_a "http://www.aftonbladet.se" "apa"
|
click a_a "http://www.aftonbladet.se" "apa"
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: 'forest',
|
theme: 'forest',
|
||||||
// themeCSS: '.node rect { fill: red; }',
|
// themeCSS: '.node rect { fill: red; }',
|
||||||
|
46
cypress/platform/flow2.html
Normal file
46
cypress/platform/flow2.html
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet" />
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: 'trebuchet ms', verdana, arial;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<pre class="mermaid">
|
||||||
|
graph TB
|
||||||
|
subgraph One
|
||||||
|
a1-->a2-->a3
|
||||||
|
end
|
||||||
|
</pre>
|
||||||
|
<pre class="mermaid">
|
||||||
|
graph TB
|
||||||
|
a_a --> b_b:::apa --> c_c:::apa
|
||||||
|
classDef apa fill:#f9f,stroke:#333,stroke-width:4px;
|
||||||
|
class a_a apa;
|
||||||
|
</pre>
|
||||||
|
<pre class="mermaid">
|
||||||
|
graph TB
|
||||||
|
a_a(Aftonbladet) --> b_b[gorilla]:::apa --> c_c{chimp}:::apa -->a_a
|
||||||
|
a_a --> c --> d_d --> c_c
|
||||||
|
classDef apa fill:#f9f,stroke:#333,stroke-width:4px;
|
||||||
|
class a_a apa;
|
||||||
|
click a_a "http://www.aftonbladet.se" "apa"
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<script type="module">
|
||||||
|
import mermaid from '../../packages/mermaid/src/mermaid';
|
||||||
|
|
||||||
|
mermaid.initialize({
|
||||||
|
theme: 'forest',
|
||||||
|
// themeCSS: '.node rect { fill: red; }',
|
||||||
|
logLevel: 3,
|
||||||
|
flowchart: { curve: 'linear' },
|
||||||
|
gantt: { axisFormat: '%m/%d/%Y' },
|
||||||
|
sequence: { actorMargin: 50 },
|
||||||
|
// sequenceDiagram: { actorMargin: 300 } // deprecated
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -8,8 +8,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<svg id="diagram"></svg>
|
<svg id="diagram"></svg>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({ startOnLoad: false, logLevel: 0 });
|
mermaid.initialize({ startOnLoad: false, logLevel: 0 });
|
||||||
|
|
||||||
const graph = `
|
const graph = `
|
||||||
@ -19,7 +19,7 @@
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
const diagram = document.getElementById('diagram');
|
const diagram = document.getElementById('diagram');
|
||||||
const svg = mermaid.render('diagram-svg', graph);
|
const { svg } = await mermaid.render('diagram-svg', graph);
|
||||||
diagram.innerHTML = svg;
|
diagram.innerHTML = svg;
|
||||||
if (window.Cypress) {
|
if (window.Cypress) {
|
||||||
window.rendered = true;
|
window.rendered = true;
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<svg id="diagram"></svg>
|
<svg id="diagram"></svg>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({ startOnLoad: false, logLevel: 0 });
|
mermaid.initialize({ startOnLoad: false, logLevel: 0 });
|
||||||
|
|
||||||
const graph = `
|
const graph = `
|
||||||
@ -19,7 +19,7 @@
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
const diagram = document.getElementById('diagram');
|
const diagram = document.getElementById('diagram');
|
||||||
const svg = mermaid.render('diagram-svg', graph);
|
const { svg } = await mermaid.render('diagram-svg', graph);
|
||||||
diagram.innerHTML = svg;
|
diagram.innerHTML = svg;
|
||||||
if (window.Cypress) {
|
if (window.Cypress) {
|
||||||
window.rendered = true;
|
window.rendered = true;
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
<div id="diagram" class="mermaid"></div>
|
<div id="diagram" class="mermaid"></div>
|
||||||
<div id="res" class=""></div>
|
<div id="res" class=""></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
@ -91,13 +91,11 @@
|
|||||||
diagram += 'le> * { background : red}</style>test</p>"]';
|
diagram += 'le> * { background : red}</style>test</p>"]';
|
||||||
|
|
||||||
console.log(diagram);
|
console.log(diagram);
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
const { svg } = await mermaid.render('diagram', diagram);
|
||||||
mermaid.render('diagram', diagram, (res) => {
|
document.querySelector('#res').innerHTML = svg;
|
||||||
document.querySelector('#res').innerHTML = res;
|
|
||||||
if (window.Cypress) {
|
if (window.Cypress) {
|
||||||
window.rendered = true;
|
window.rendered = true;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -43,8 +43,8 @@
|
|||||||
cssClass "BankAccount" customCss
|
cssClass "BankAccount" customCss
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
|
@ -130,8 +130,8 @@
|
|||||||
commit
|
commit
|
||||||
merge main
|
merge main
|
||||||
</pre>
|
</pre>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
|
@ -98,8 +98,8 @@
|
|||||||
commit
|
commit
|
||||||
merge main
|
merge main
|
||||||
</pre>
|
</pre>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
|
File diff suppressed because one or more lines are too long
@ -7,8 +7,8 @@
|
|||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
info
|
info
|
||||||
</pre>
|
</pre>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: 'forest',
|
theme: 'forest',
|
||||||
// themeCSS: '.node rect { fill: red; }',
|
// themeCSS: '.node rect { fill: red; }',
|
||||||
|
@ -87,8 +87,8 @@
|
|||||||
Add another diagram to demo page : 48h
|
Add another diagram to demo page : 48h
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
function clickByFlow(elemName) {
|
function clickByFlow(elemName) {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
div.className = 'created-by-click';
|
div.className = 'created-by-click';
|
||||||
|
@ -59,7 +59,7 @@ A-->B
|
|||||||
>
|
>
|
||||||
<script src="./packages/mermaid-mindmap/dist/mermaid-mindmap-detector.js"></script>
|
<script src="./packages/mermaid-mindmap/dist/mermaid-mindmap-detector.js"></script>
|
||||||
<script src="./packages/mermaid-mindmap/dist/mermaid-example-diagram-detector.js"></script>
|
<script src="./packages/mermaid-mindmap/dist/mermaid-example-diagram-detector.js"></script>
|
||||||
<script src="./packages/mermaid/dist/mermaid.js"></script>
|
<script src="./packages/mermaid/dist/mermaid.esm.mjs"></script>
|
||||||
<script>
|
<script>
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
|
@ -1,14 +1,4 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
<script src="http://localhost:9000/mermaid.js"></script>
|
|
||||||
<script>
|
|
||||||
mermaid.initialize({
|
|
||||||
theme: 'base',
|
|
||||||
themeVariables: {},
|
|
||||||
startOnLoad: true,
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
<body>
|
||||||
<h1>Example</h1>
|
<h1>Example</h1>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
@ -26,4 +16,12 @@ sequenceDiagram
|
|||||||
Note left of Ernie: Cookies are good
|
Note left of Ernie: Cookies are good
|
||||||
</pre>
|
</pre>
|
||||||
</body>
|
</body>
|
||||||
|
<script type="module">
|
||||||
|
import mermaid from '/mermaid.esm.mjs';
|
||||||
|
mermaid.initialize({
|
||||||
|
theme: 'base',
|
||||||
|
themeVariables: {},
|
||||||
|
startOnLoad: true,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
@ -9,19 +9,19 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="graph"></div>
|
<div id="graph"></div>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.init({ startOnLoad: false });
|
await mermaid.initialize({ startOnLoad: false });
|
||||||
|
await mermaid.run();
|
||||||
|
|
||||||
mermaid.mermaidAPI.initialize({ securityLevel: 'strict' });
|
await mermaid.mermaidAPI.initialize({ securityLevel: 'strict' });
|
||||||
try {
|
try {
|
||||||
console.log('rendering');
|
console.log('rendering');
|
||||||
mermaid.mermaidAPI.render('graphDiv', `>`);
|
await mermaid.mermaidAPI.render('graphDiv', `>`);
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
mermaid.mermaidAPI.render('graphDiv', `graph LR\n a --> b`, (html) => {
|
const { svg } = await mermaid.mermaidAPI.render('graphDiv', `graph LR\n a --> b`);
|
||||||
document.getElementById('graph').innerHTML = html;
|
document.getElementById('graph').innerHTML = svg;
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -9,20 +9,20 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="graph"></div>
|
<div id="graph"></div>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.init({ startOnLoad: false });
|
mermaid.initialize({ startOnLoad: false });
|
||||||
mermaid.mermaidAPI.initialize();
|
mermaid.mermaidAPI.initialize();
|
||||||
|
|
||||||
rerender('XMas');
|
async function rerender(text) {
|
||||||
|
|
||||||
function rerender(text) {
|
|
||||||
const graphText = `graph TD
|
const graphText = `graph TD
|
||||||
A[${text}] -->|Get money| B(Go shopping)`;
|
A[${text}] -->|Get money| B(Go shopping)`;
|
||||||
const graph = mermaid.mermaidAPI.render('id', graphText);
|
const { svg } = await mermaid.mermaidAPI.render('id', graphText);
|
||||||
console.log('\x1b[35m%s\x1b[0m', '>> graph', graph);
|
console.log('\x1b[35m%s\x1b[0m', '>> graph', svg);
|
||||||
document.getElementById('graph').innerHTML = graph;
|
document.getElementById('graph').innerHTML = svg;
|
||||||
}
|
}
|
||||||
|
window.rerender = rerender;
|
||||||
|
await rerender('XMas');
|
||||||
</script>
|
</script>
|
||||||
<button id="rerender" onclick="rerender('Saturday')">Rerender</button>
|
<button id="rerender" onclick="rerender('Saturday')">Rerender</button>
|
||||||
</body>
|
</body>
|
||||||
|
@ -313,8 +313,8 @@ requirementDiagram
|
|||||||
merge release
|
merge release
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
|
@ -308,8 +308,8 @@ gitGraph
|
|||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
|
@ -308,8 +308,8 @@ gitGraph
|
|||||||
merge release
|
merge release
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
|
@ -301,8 +301,8 @@ requirementDiagram
|
|||||||
merge release
|
merge release
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
|
@ -305,8 +305,8 @@ requirementDiagram
|
|||||||
merge release
|
merge release
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
|
@ -305,8 +305,8 @@ requirementDiagram
|
|||||||
merge release
|
merge release
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
|
@ -239,12 +239,6 @@ sequenceDiagram
|
|||||||
Today: 1, -1h
|
Today: 1, -1h
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<!-- <div id="cy"></div> -->
|
|
||||||
<!-- <script src="http://localhost:9000/packages/mermaid-mindmap/dist/mermaid-mindmap-detector.js"></script> -->
|
|
||||||
<!-- <script src="./mermaid-example-diagram-detector.js"></script> -->
|
|
||||||
<!-- <script src="//cdn.jsdelivr.net/npm/mermaid@9.1.7/dist/mermaid.min.js"></script> -->
|
|
||||||
<!-- <script src="./mermaid.js"></script> -->
|
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import mermaid from '../../packages/mermaid/src/mermaid';
|
import mermaid from '../../packages/mermaid/src/mermaid';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
|
@ -34,8 +34,8 @@
|
|||||||
9e122290-->82072290_1ec3_e711_8c5a_005056ad0002
|
9e122290-->82072290_1ec3_e711_8c5a_005056ad0002
|
||||||
style 9e122290 fill:#F99,stroke-width:2px,stroke:#F0F
|
style 9e122290 fill:#F99,stroke-width:2px,stroke:#F0F
|
||||||
</pre>
|
</pre>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
function showFullFirstSquad(elemName) {
|
function showFullFirstSquad(elemName) {
|
||||||
console.log('show ' + elemName);
|
console.log('show ' + elemName);
|
||||||
}
|
}
|
||||||
|
@ -120,8 +120,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
Get into car:4: Dad, Mum, Child 1, Child 2
|
Get into car:4: Dad, Mum, Child 1, Child 2
|
||||||
Drive home:3: Dad
|
Drive home:3: Dad
|
||||||
</pre>
|
</pre>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: 'forest',
|
theme: 'forest',
|
||||||
logLevel: 3,
|
logLevel: 3,
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
A --> B --> C
|
A --> B --> C
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
function showFullFirstSquad(elemName) {
|
function showFullFirstSquad(elemName) {
|
||||||
console.log('show ' + elemName);
|
console.log('show ' + elemName);
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ function merge(current, update) {
|
|||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
||||||
const contentLoadedApi = function () {
|
const contentLoadedApi = async function () {
|
||||||
let pos = document.location.href.indexOf('?graph=');
|
let pos = document.location.href.indexOf('?graph=');
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
pos = pos + 7;
|
pos = pos + 7;
|
||||||
@ -102,39 +102,26 @@ const contentLoadedApi = function () {
|
|||||||
mermaid2.initialize(cnf);
|
mermaid2.initialize(cnf);
|
||||||
|
|
||||||
for (let i = 0; i < numCodes; i++) {
|
for (let i = 0; i < numCodes; i++) {
|
||||||
mermaid2.render(
|
const { svg, bindFunctions } = await mermaid2.render(
|
||||||
'newid' + i,
|
'newid' + i,
|
||||||
graphObj.code[i],
|
graphObj.code[i],
|
||||||
(svgCode, bindFunctions) => {
|
|
||||||
div.innerHTML = svgCode;
|
|
||||||
|
|
||||||
bindFunctions(div);
|
|
||||||
},
|
|
||||||
divs[i]
|
divs[i]
|
||||||
);
|
);
|
||||||
|
div.innerHTML = svg;
|
||||||
|
bindFunctions(div);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
div.id = 'block';
|
div.id = 'block';
|
||||||
div.className = 'mermaid';
|
div.className = 'mermaid';
|
||||||
// div.innerHTML = graphObj.code
|
|
||||||
console.warn('graphObj.mermaid', graphObj.mermaid);
|
console.warn('graphObj.mermaid', graphObj.mermaid);
|
||||||
document.getElementsByTagName('body')[0].appendChild(div);
|
document.getElementsByTagName('body')[0].appendChild(div);
|
||||||
mermaid2.initialize(graphObj.mermaid);
|
mermaid2.initialize(graphObj.mermaid);
|
||||||
|
|
||||||
mermaid2.render(
|
const { svg, bindFunctions } = await mermaid2.render('newid', graphObj.code, div);
|
||||||
'newid',
|
div.innerHTML = svg;
|
||||||
graphObj.code,
|
|
||||||
(svgCode, bindFunctions) => {
|
|
||||||
div.innerHTML = svgCode;
|
|
||||||
|
|
||||||
if (bindFunctions) {
|
|
||||||
bindFunctions(div);
|
bindFunctions(div);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
div
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
markRendered();
|
markRendered();
|
||||||
};
|
};
|
||||||
@ -148,7 +135,7 @@ if (typeof document !== 'undefined') {
|
|||||||
function () {
|
function () {
|
||||||
if (this.location.href.match('xss.html')) {
|
if (this.location.href.match('xss.html')) {
|
||||||
this.console.log('Using api');
|
this.console.log('Using api');
|
||||||
contentLoadedApi();
|
void contentLoadedApi();
|
||||||
} else {
|
} else {
|
||||||
this.console.log('Not using api');
|
this.console.log('Not using api');
|
||||||
void contentLoaded();
|
void contentLoaded();
|
||||||
|
@ -33,8 +33,8 @@
|
|||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
startOnLoad: false,
|
startOnLoad: false,
|
||||||
useMaxWidth: true,
|
useMaxWidth: true,
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
<div id="diagram" class="mermaid"></div>
|
<div id="diagram" class="mermaid"></div>
|
||||||
<div id="res" class=""></div>
|
<div id="res" class=""></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
@ -104,10 +104,9 @@
|
|||||||
// diagram += "=xssAttack()> --> B";
|
// diagram += "=xssAttack()> --> B";
|
||||||
console.log(diagram);
|
console.log(diagram);
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
// document.querySelector('#diagram').innerHTML = diagram;
|
||||||
mermaid.render('diagram', diagram, (res) => {
|
const { svg } = await mermaid.render('diagram', diagram);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
document.querySelector('#res').innerHTML = res;
|
document.querySelector('#res').innerHTML = svg;
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
<div id="diagram" class="mermaid"></div>
|
<div id="diagram" class="mermaid"></div>
|
||||||
<div id="res" class=""></div>
|
<div id="res" class=""></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
@ -102,10 +102,9 @@
|
|||||||
// diagram += "=xssAttack()> --> B";
|
// diagram += "=xssAttack()> --> B";
|
||||||
console.log(diagram);
|
console.log(diagram);
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
// document.querySelector('#diagram').innerHTML = diagram;
|
||||||
mermaid.render('diagram', diagram, (res) => {
|
const { svg } = await mermaid.render('diagram', diagram);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
document.querySelector('#res').innerHTML = res;
|
document.querySelector('#res').innerHTML = svg;
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
<div id="diagram" class="mermaid"></div>
|
<div id="diagram" class="mermaid"></div>
|
||||||
<div id="res" class=""></div>
|
<div id="res" class=""></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
@ -102,10 +102,9 @@
|
|||||||
// diagram += "=xssAttack()> --> B";
|
// diagram += "=xssAttack()> --> B";
|
||||||
console.log(diagram);
|
console.log(diagram);
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
// document.querySelector('#diagram').innerHTML = diagram;
|
||||||
mermaid.render('diagram', diagram, (res) => {
|
const { svg } = await mermaid.render('diagram', diagram);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
document.querySelector('#res').innerHTML = res;
|
document.querySelector('#res').innerHTML = svg;
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
<div id="diagram" class="mermaid"></div>
|
<div id="diagram" class="mermaid"></div>
|
||||||
<div id="res" class=""></div>
|
<div id="res" class=""></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
@ -102,10 +102,9 @@
|
|||||||
// diagram += "=xssAttack()> --> B";
|
// diagram += "=xssAttack()> --> B";
|
||||||
console.log(diagram);
|
console.log(diagram);
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
// document.querySelector('#diagram').innerHTML = diagram;
|
||||||
mermaid.render('diagram', diagram, (res) => {
|
const { svg } = await mermaid.render('diagram', diagram);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
document.querySelector('#res').innerHTML = res;
|
document.querySelector('#res').innerHTML = svg;
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
<div id="diagram" class="mermaid"></div>
|
<div id="diagram" class="mermaid"></div>
|
||||||
<div id="res" class=""></div>
|
<div id="res" class=""></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
@ -104,10 +104,9 @@
|
|||||||
// diagram += "=xssAttack()> --> B";
|
// diagram += "=xssAttack()> --> B";
|
||||||
console.log(diagram);
|
console.log(diagram);
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
// document.querySelector('#diagram').innerHTML = diagram;
|
||||||
mermaid.render('diagram', diagram, (res) => {
|
const { svg } = await mermaid.render('diagram', diagram);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
document.querySelector('#res').innerHTML = res;
|
document.querySelector('#res').innerHTML = svg;
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
<div id="diagram" class="mermaid"></div>
|
<div id="diagram" class="mermaid"></div>
|
||||||
<div id="res" class=""></div>
|
<div id="res" class=""></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
@ -103,10 +103,9 @@
|
|||||||
// diagram += "=xssAttack()> --> B";
|
// diagram += "=xssAttack()> --> B";
|
||||||
console.log(diagram);
|
console.log(diagram);
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
// document.querySelector('#diagram').innerHTML = diagram;
|
||||||
mermaid.render('diagram', diagram, (res) => {
|
const { svg } = await mermaid.render('diagram', diagram);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
document.querySelector('#res').innerHTML = res;
|
document.querySelector('#res').innerHTML = svg;
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
<div id="diagram" class="mermaid"></div>
|
<div id="diagram" class="mermaid"></div>
|
||||||
<div id="res" class=""></div>
|
<div id="res" class=""></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
@ -102,10 +102,9 @@
|
|||||||
// diagram += '//via.placeholder.com/64\' width=64 />"]';
|
// diagram += '//via.placeholder.com/64\' width=64 />"]';
|
||||||
// console.log(diagram);
|
// console.log(diagram);
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
// document.querySelector('#diagram').innerHTML = diagram;
|
||||||
mermaid.render('diagram', diagram, (res) => {
|
const { svg } = await mermaid.render('diagram', diagram);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
document.querySelector('#res').innerHTML = res;
|
document.querySelector('#res').innerHTML = svg;
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
<div id="diagram" class="mermaid"></div>
|
<div id="diagram" class="mermaid"></div>
|
||||||
<div id="res" class=""></div>
|
<div id="res" class=""></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
@ -102,10 +102,9 @@
|
|||||||
// diagram += '//via.placeholder.com/64\' width=64 />"]';
|
// diagram += '//via.placeholder.com/64\' width=64 />"]';
|
||||||
// console.log(diagram);
|
// console.log(diagram);
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
// document.querySelector('#diagram').innerHTML = diagram;
|
||||||
mermaid.render('diagram', diagram, (res) => {
|
const { svg } = await mermaid.render('diagram', diagram);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
document.querySelector('#res').innerHTML = res;
|
document.querySelector('#res').innerHTML = svg;
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
<div id="diagram" class="mermaid"></div>
|
<div id="diagram" class="mermaid"></div>
|
||||||
<div id="res" class=""></div>
|
<div id="res" class=""></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
@ -101,10 +101,9 @@
|
|||||||
// diagram += '//via.placeholder.com/64\' width=64 />"]';
|
// diagram += '//via.placeholder.com/64\' width=64 />"]';
|
||||||
// console.log(diagram);
|
// console.log(diagram);
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
// document.querySelector('#diagram').innerHTML = diagram;
|
||||||
mermaid.render('diagram', diagram, (res) => {
|
const { svg } = await mermaid.render('diagram', diagram);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
document.querySelector('#res').innerHTML = res;
|
document.querySelector('#res').innerHTML = svg;
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
<div id="diagram" class="mermaid"></div>
|
<div id="diagram" class="mermaid"></div>
|
||||||
<div id="res" class=""></div>
|
<div id="res" class=""></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
@ -103,10 +103,9 @@ class Shape{
|
|||||||
// diagram += '//via.placeholder.com/64\' width=64 />"]';
|
// diagram += '//via.placeholder.com/64\' width=64 />"]';
|
||||||
// console.log(diagram);
|
// console.log(diagram);
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
// document.querySelector('#diagram').innerHTML = diagram;
|
||||||
mermaid.render('diagram', diagram, (res) => {
|
const { svg } = await mermaid.render('diagram', diagram);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
document.querySelector('#res').innerHTML = res;
|
document.querySelector('#res').innerHTML = svg;
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -48,8 +48,8 @@
|
|||||||
Alice->>Bob: Hi Bob
|
Alice->>Bob: Hi Bob
|
||||||
Bob->>Alice: Hi Alice
|
Bob->>Alice: Hi Alice
|
||||||
</pre>
|
</pre>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
startOnLoad: true,
|
startOnLoad: true,
|
||||||
useMaxWidth: true,
|
useMaxWidth: true,
|
||||||
@ -59,7 +59,7 @@
|
|||||||
const handler = setInterval(() => {
|
const handler = setInterval(() => {
|
||||||
cnt++;
|
cnt++;
|
||||||
a = {};
|
a = {};
|
||||||
if (typeof a.polluted !== 'undefined') {
|
if (a.polluted !== undefined) {
|
||||||
clearInterval(handler);
|
clearInterval(handler);
|
||||||
xssAttack();
|
xssAttack();
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
<div id="diagram" class="mermaid"></div>
|
<div id="diagram" class="mermaid"></div>
|
||||||
<div id="res" class=""></div>
|
<div id="res" class=""></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
@ -101,10 +101,8 @@ A --> B["<a href='javasc`;
|
|||||||
diagram += `ript#colon;xssAttack()'>AAA</a>"]`;
|
diagram += `ript#colon;xssAttack()'>AAA</a>"]`;
|
||||||
// diagram += '//via.placeholder.com/64\' width=64 />"]';
|
// diagram += '//via.placeholder.com/64\' width=64 />"]';
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
// document.querySelector('#diagram').innerHTML = diagram;
|
||||||
mermaid.render('diagram', diagram, (res) => {
|
const { svg } = await mermaid.render('diagram', diagram);
|
||||||
// console.log(res);
|
document.querySelector('#res').innerHTML = svg;
|
||||||
document.querySelector('#res').innerHTML = res;
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
<div id="diagram" class="mermaid"></div>
|
<div id="diagram" class="mermaid"></div>
|
||||||
<div id="res" class=""></div>
|
<div id="res" class=""></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
@ -97,14 +97,12 @@
|
|||||||
// A --> B["<a href='javascript`;
|
// A --> B["<a href='javascript`;
|
||||||
// diagram += `ript#colon;xssAttack()'>AAA</a>"]`;
|
// diagram += `ript#colon;xssAttack()'>AAA</a>"]`;
|
||||||
let diagram = ` graph TD
|
let diagram = ` graph TD
|
||||||
A --> B["<a href='javasc`;
|
A --> B["<a href='javasc`;
|
||||||
diagram += `ript#9;t#colon;xssAttack()'>AAA</a>"]`;
|
diagram += `ript#9;t#colon;xssAttack()'>AAA</a>"]`;
|
||||||
// diagram += '//via.placeholder.com/64\' width=64 />"]';
|
// diagram += '//via.placeholder.com/64\' width=64 />"]';
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
// document.querySelector('#diagram').innerHTML = diagram;
|
||||||
mermaid.render('diagram', diagram, (res) => {
|
const { svg } = await mermaid.render('diagram', diagram);
|
||||||
console.log(res);
|
document.querySelector('#res').innerHTML = svg;
|
||||||
document.querySelector('#res').innerHTML = res;
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
graph TD
|
graph TD
|
||||||
A --> B["<a href='javascript#9;t#colon;alert(document.location)'>AAA</a>"]
|
A --> B["<a href='javascript#9;t#colon;alert(document.location)'>AAA</a>"]
|
||||||
</pre>
|
</pre>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({ startOnLoad: true });
|
mermaid.initialize({ startOnLoad: true });
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
@ -36,8 +36,8 @@
|
|||||||
graph LR
|
graph LR
|
||||||
A --> B
|
A --> B
|
||||||
</pre>
|
</pre>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
startOnLoad: true,
|
startOnLoad: true,
|
||||||
useMaxWidth: true,
|
useMaxWidth: true,
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
<div id="diagram" class="mermaid"></div>
|
<div id="diagram" class="mermaid"></div>
|
||||||
<div id="res" class=""></div>
|
<div id="res" class=""></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
@ -95,9 +95,8 @@
|
|||||||
|
|
||||||
console.log(diagram);
|
console.log(diagram);
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
// document.querySelector('#diagram').innerHTML = diagram;
|
||||||
mermaid.render('diagram', diagram, (res) => {
|
const { svg } = await mermaid.render('diagram', diagram);
|
||||||
document.querySelector('#res').innerHTML = res;
|
document.querySelector('#res').innerHTML = svg;
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
<div id="diagram" class="mermaid"></div>
|
<div id="diagram" class="mermaid"></div>
|
||||||
<div id="res" class=""></div>
|
<div id="res" class=""></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
@ -99,10 +99,9 @@
|
|||||||
|
|
||||||
console.log(diagram);
|
console.log(diagram);
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
// document.querySelector('#diagram').innerHTML = diagram;
|
||||||
mermaid.render('diagram', diagram, (res) => {
|
const { svg } = await mermaid.render('diagram', diagram);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
document.querySelector('#res').innerHTML = res;
|
document.querySelector('#res').innerHTML = svg;
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
<div id="diagram" class="mermaid"></div>
|
<div id="diagram" class="mermaid"></div>
|
||||||
<div id="res" class=""></div>
|
<div id="res" class=""></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
@ -97,10 +97,9 @@
|
|||||||
// diagram += "script\u003aalert\u0028document.domain\u0029\` src=x>\"\);\n";
|
// diagram += "script\u003aalert\u0028document.domain\u0029\` src=x>\"\);\n";
|
||||||
console.log(diagram);
|
console.log(diagram);
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
// document.querySelector('#diagram').innerHTML = diagram;
|
||||||
mermaid.render('diagram', diagram, (res) => {
|
const { svg } = await mermaid.render('diagram', diagram);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
document.querySelector('#res').innerHTML = res;
|
document.querySelector('#res').innerHTML = svg;
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
<div id="diagram" class="mermaid"></div>
|
<div id="diagram" class="mermaid"></div>
|
||||||
<div id="res" class=""></div>
|
<div id="res" class=""></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
@ -99,10 +99,9 @@
|
|||||||
// diagram += "script\u003aalert\u0028document.domain\u0029\` src=x>\"\);\n";
|
// diagram += "script\u003aalert\u0028document.domain\u0029\` src=x>\"\);\n";
|
||||||
console.log(diagram);
|
console.log(diagram);
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
// document.querySelector('#diagram').innerHTML = diagram;
|
||||||
mermaid.render('diagram', diagram, (res) => {
|
const { svg } = await mermaid.render('diagram', diagram);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
document.querySelector('#res').innerHTML = res;
|
document.querySelector('#res').innerHTML = svg;
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
<div id="diagram" class="mermaid"></div>
|
<div id="diagram" class="mermaid"></div>
|
||||||
<div id="res" class=""></div>
|
<div id="res" class=""></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
@ -98,10 +98,9 @@
|
|||||||
// diagram += "script\u003aalert\u0028document.domain\u0029\` src=x>\"\);\n";
|
// diagram += "script\u003aalert\u0028document.domain\u0029\` src=x>\"\);\n";
|
||||||
console.log(diagram);
|
console.log(diagram);
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
// document.querySelector('#diagram').innerHTML = diagram;
|
||||||
mermaid.render('diagram', diagram, (res) => {
|
const { svg } = await mermaid.render('diagram', diagram);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
document.querySelector('#res').innerHTML = res;
|
document.querySelector('#res').innerHTML = svg;
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
<div id="diagram" class="mermaid"></div>
|
<div id="diagram" class="mermaid"></div>
|
||||||
<div id="res" class=""></div>
|
<div id="res" class=""></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
@ -98,10 +98,9 @@
|
|||||||
// diagram += "script\u003aalert\u0028document.domain\u0029\` src=x>\"\);\n";
|
// diagram += "script\u003aalert\u0028document.domain\u0029\` src=x>\"\);\n";
|
||||||
console.log(diagram);
|
console.log(diagram);
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
// document.querySelector('#diagram').innerHTML = diagram;
|
||||||
mermaid.render('diagram', diagram, (res) => {
|
const { svg } = await mermaid.render('diagram', diagram);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
document.querySelector('#res').innerHTML = res;
|
document.querySelector('#res').innerHTML = svg;
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -217,8 +217,8 @@
|
|||||||
</pre>
|
</pre>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
const ALLOWED_TAGS = [
|
const ALLOWED_TAGS = [
|
||||||
'a',
|
'a',
|
||||||
'b',
|
'b',
|
||||||
@ -273,8 +273,7 @@
|
|||||||
},
|
},
|
||||||
// sequenceDiagram: { actorMargin: 300 } // deprecated
|
// sequenceDiagram: { actorMargin: 300 } // deprecated
|
||||||
});
|
});
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
function testClick(nodeId) {
|
function testClick(nodeId) {
|
||||||
console.log('clicked', nodeId);
|
console.log('clicked', nodeId);
|
||||||
let originalBgColor = document.querySelector('body').style.backgroundColor;
|
let originalBgColor = document.querySelector('body').style.backgroundColor;
|
||||||
@ -283,21 +282,18 @@
|
|||||||
document.querySelector('body').style.backgroundColor = originalBgColor;
|
document.querySelector('body').style.backgroundColor = originalBgColor;
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
</script>
|
|
||||||
<script>
|
const testLineEndings = async (test, input) => {
|
||||||
const testLineEndings = (test, input) => {
|
|
||||||
try {
|
try {
|
||||||
mermaid.render(test, input, () => {
|
await mermaid.render(test, input);
|
||||||
//no-op
|
|
||||||
});
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error in %s:\n\n%s', test, err);
|
console.error('Error in %s:\n\n%s', test, err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
testLineEndings('CR', 'graph LR\rsubgraph CR\rA --> B\rend');
|
await testLineEndings('CR', 'graph LR\rsubgraph CR\rA --> B\rend');
|
||||||
testLineEndings('LF', 'graph LR\nsubgraph LF\nA --> B\nend');
|
await testLineEndings('LF', 'graph LR\nsubgraph LF\nA --> B\nend');
|
||||||
testLineEndings('CRLF', 'graph LR\r\nsubgraph CRLF\r\nA --> B\r\nend');
|
await testLineEndings('CRLF', 'graph LR\r\nsubgraph CRLF\r\nA --> B\r\nend');
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -154,8 +154,8 @@
|
|||||||
</pre>
|
</pre>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: 'default',
|
theme: 'default',
|
||||||
// themeCSS: '.node rect { fill: red; }',
|
// themeCSS: '.node rect { fill: red; }',
|
||||||
|
@ -34,8 +34,8 @@
|
|||||||
noSide[|borders:no| stroke no side ];
|
noSide[|borders:no| stroke no side ];
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: 'forest',
|
theme: 'forest',
|
||||||
logLevel: 3,
|
logLevel: 3,
|
||||||
|
@ -109,8 +109,8 @@
|
|||||||
MANUFACTURER only one to zero or more CAR : makes
|
MANUFACTURER only one to zero or more CAR : makes
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: 'default',
|
theme: 'default',
|
||||||
|
|
||||||
|
@ -1507,8 +1507,8 @@
|
|||||||
|
|
||||||
<h1 id="link-clicked">Anchor for "link-clicked" test</h1>
|
<h1 id="link-clicked">Anchor for "link-clicked" test</h1>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: 'forest',
|
theme: 'forest',
|
||||||
logLevel: 3,
|
logLevel: 3,
|
||||||
|
@ -182,8 +182,8 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
logLevel: 3,
|
logLevel: 3,
|
||||||
securityLevel: 'loose',
|
securityLevel: 'loose',
|
||||||
|
@ -38,8 +38,8 @@
|
|||||||
merge newbranch
|
merge newbranch
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
const ALLOWED_TAGS = [
|
const ALLOWED_TAGS = [
|
||||||
'a',
|
'a',
|
||||||
'b',
|
'b',
|
||||||
|
@ -32,8 +32,8 @@
|
|||||||
Sit down: 3: Me
|
Sit down: 3: Me
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: 'forest',
|
theme: 'forest',
|
||||||
logLevel: 3,
|
logLevel: 3,
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import mermaid from './mermaid.esm.mjs';
|
import mermaid from './mermaid.esm.mjs';
|
||||||
import mermaidMindmap from './mermaid-mindmap.esm.mjs';
|
|
||||||
|
|
||||||
const ALLOWED_TAGS = [
|
const ALLOWED_TAGS = [
|
||||||
'a',
|
'a',
|
||||||
|
@ -159,8 +159,8 @@
|
|||||||
An Example <- copies - test_entity2
|
An Example <- copies - test_entity2
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: 'neutral',
|
theme: 'neutral',
|
||||||
// themeCSS: '.node rect { fill: red; }',
|
// themeCSS: '.node rect { fill: red; }',
|
||||||
|
@ -144,8 +144,8 @@
|
|||||||
>
|
>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: 'base',
|
theme: 'base',
|
||||||
// themeCSS: '.node rect { fill: red; }',
|
// themeCSS: '.node rect { fill: red; }',
|
||||||
|
@ -218,8 +218,8 @@
|
|||||||
</pre>
|
</pre>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: 'default',
|
theme: 'default',
|
||||||
// themeCSS: '.node rect { fill: red; }',
|
// themeCSS: '.node rect { fill: red; }',
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
1940 : fourth step : fifth step
|
1940 : fourth step : fifth step
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<script src="./mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: 'forest',
|
theme: 'forest',
|
||||||
logLevel: 1,
|
logLevel: 1,
|
||||||
|
19
docs/config/setup/interfaces/mermaidAPI.ParseOptions.md
Normal file
19
docs/config/setup/interfaces/mermaidAPI.ParseOptions.md
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
> **Warning**
|
||||||
|
>
|
||||||
|
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
|
||||||
|
>
|
||||||
|
> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/interfaces/mermaidAPI.ParseOptions.md](../../../../packages/mermaid/src/docs/config/setup/interfaces/mermaidAPI.ParseOptions.md).
|
||||||
|
|
||||||
|
# Interface: ParseOptions
|
||||||
|
|
||||||
|
[mermaidAPI](../modules/mermaidAPI.md).ParseOptions
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
### suppressErrors
|
||||||
|
|
||||||
|
• `Optional` **suppressErrors**: `boolean`
|
||||||
|
|
||||||
|
#### Defined in
|
||||||
|
|
||||||
|
[mermaidAPI.ts:70](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L70)
|
54
docs/config/setup/interfaces/mermaidAPI.RenderResult.md
Normal file
54
docs/config/setup/interfaces/mermaidAPI.RenderResult.md
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
> **Warning**
|
||||||
|
>
|
||||||
|
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
|
||||||
|
>
|
||||||
|
> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/interfaces/mermaidAPI.RenderResult.md](../../../../packages/mermaid/src/docs/config/setup/interfaces/mermaidAPI.RenderResult.md).
|
||||||
|
|
||||||
|
# Interface: RenderResult
|
||||||
|
|
||||||
|
[mermaidAPI](../modules/mermaidAPI.md).RenderResult
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
### bindFunctions
|
||||||
|
|
||||||
|
• `Optional` **bindFunctions**: (`element`: `Element`) => `void`
|
||||||
|
|
||||||
|
#### Type declaration
|
||||||
|
|
||||||
|
▸ (`element`): `void`
|
||||||
|
|
||||||
|
Bind function to be called after the svg has been inserted into the DOM.
|
||||||
|
This is necessary for adding event listeners to the elements in the svg.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { svg, bindFunctions } = mermaidAPI.render('id1', 'graph TD;A-->B');
|
||||||
|
div.innerHTML = svg;
|
||||||
|
bindFunctions?.(div); // To call bindFunctions only if it's present.
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Parameters
|
||||||
|
|
||||||
|
| Name | Type |
|
||||||
|
| :-------- | :-------- |
|
||||||
|
| `element` | `Element` |
|
||||||
|
|
||||||
|
##### Returns
|
||||||
|
|
||||||
|
`void`
|
||||||
|
|
||||||
|
#### Defined in
|
||||||
|
|
||||||
|
[mermaidAPI.ts:91](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L91)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### svg
|
||||||
|
|
||||||
|
• **svg**: `string`
|
||||||
|
|
||||||
|
The svg code for the rendered graph.
|
||||||
|
|
||||||
|
#### Defined in
|
||||||
|
|
||||||
|
[mermaidAPI.ts:81](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L81)
|
@ -6,6 +6,11 @@
|
|||||||
|
|
||||||
# Module: mermaidAPI
|
# Module: mermaidAPI
|
||||||
|
|
||||||
|
## Interfaces
|
||||||
|
|
||||||
|
- [ParseOptions](../interfaces/mermaidAPI.ParseOptions.md)
|
||||||
|
- [RenderResult](../interfaces/mermaidAPI.RenderResult.md)
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
### default
|
### default
|
||||||
@ -20,13 +25,13 @@ Renames and re-exports [mermaidAPI](mermaidAPI.md#mermaidapi)
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[mermaidAPI.ts:74](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L74)
|
[mermaidAPI.ts:75](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L75)
|
||||||
|
|
||||||
## Variables
|
## Variables
|
||||||
|
|
||||||
### mermaidAPI
|
### mermaidAPI
|
||||||
|
|
||||||
• `Const` **mermaidAPI**: `Readonly`<{ `defaultConfig`: `MermaidConfig` = configApi.defaultConfig; `getConfig`: () => `MermaidConfig` = configApi.getConfig; `getSiteConfig`: () => `MermaidConfig` = configApi.getSiteConfig; `globalReset`: () => `void` ; `initialize`: (`options`: `MermaidConfig`) => `void` ; `parse`: (`text`: `string`, `parseError?`: `ParseErrorFunction`) => `boolean` ; `parseAsync`: (`text`: `string`, `parseError?`: `ParseErrorFunction`) => `Promise`<`boolean`> ; `parseDirective`: (`p`: `any`, `statement`: `string`, `context`: `string`, `type`: `string`) => `void` ; `render`: (`id`: `string`, `text`: `string`, `cb?`: (`svgCode`: `string`, `bindFunctions?`: (`element`: `Element`) => `void`) => `void`, `svgContainingElement?`: `Element`) => `string` ; `renderAsync`: (`id`: `string`, `text`: `string`, `cb?`: (`svgCode`: `string`, `bindFunctions?`: (`element`: `Element`) => `void`) => `void`, `svgContainingElement?`: `Element`) => `Promise`<`string`> ; `reset`: () => `void` ; `setConfig`: (`conf`: `MermaidConfig`) => `MermaidConfig` = configApi.setConfig; `updateSiteConfig`: (`conf`: `MermaidConfig`) => `MermaidConfig` = configApi.updateSiteConfig }>
|
• `Const` **mermaidAPI**: `Readonly`<{ `defaultConfig`: `MermaidConfig` = configApi.defaultConfig; `getConfig`: () => `MermaidConfig` = configApi.getConfig; `getSiteConfig`: () => `MermaidConfig` = configApi.getSiteConfig; `globalReset`: () => `void` ; `initialize`: (`options`: `MermaidConfig`) => `void` ; `parse`: (`text`: `string`, `parseOptions?`: [`ParseOptions`](../interfaces/mermaidAPI.ParseOptions.md)) => `Promise`<`boolean` | `void`> ; `parseDirective`: (`p`: `any`, `statement`: `string`, `context`: `string`, `type`: `string`) => `void` ; `render`: (`id`: `string`, `text`: `string`, `svgContainingElement?`: `Element`) => `Promise`<[`RenderResult`](../interfaces/mermaidAPI.RenderResult.md)> ; `reset`: () => `void` ; `setConfig`: (`conf`: `MermaidConfig`) => `MermaidConfig` = configApi.setConfig; `updateSiteConfig`: (`conf`: `MermaidConfig`) => `MermaidConfig` = configApi.updateSiteConfig }>
|
||||||
|
|
||||||
## mermaidAPI configuration defaults
|
## mermaidAPI configuration defaults
|
||||||
|
|
||||||
@ -90,7 +95,7 @@ mermaid.initialize(config);
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[mermaidAPI.ts:886](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L886)
|
[mermaidAPI.ts:680](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L680)
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
@ -121,7 +126,7 @@ Return the last node appended
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[mermaidAPI.ts:287](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L287)
|
[mermaidAPI.ts:308](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L308)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -147,7 +152,7 @@ the cleaned up svgCode
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[mermaidAPI.ts:238](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L238)
|
[mermaidAPI.ts:259](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L259)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -173,7 +178,7 @@ the string with all the user styles
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[mermaidAPI.ts:167](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L167)
|
[mermaidAPI.ts:188](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L188)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -196,7 +201,7 @@ the string with all the user styles
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[mermaidAPI.ts:215](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L215)
|
[mermaidAPI.ts:236](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L236)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -223,7 +228,7 @@ with an enclosing block that has each of the cssClasses followed by !important;
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[mermaidAPI.ts:151](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L151)
|
[mermaidAPI.ts:172](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L172)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -243,7 +248,7 @@ with an enclosing block that has each of the cssClasses followed by !important;
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[mermaidAPI.ts:131](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L131)
|
[mermaidAPI.ts:152](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L152)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -263,7 +268,7 @@ with an enclosing block that has each of the cssClasses followed by !important;
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[mermaidAPI.ts:102](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L102)
|
[mermaidAPI.ts:123](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L123)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -289,7 +294,7 @@ Put the svgCode into an iFrame. Return the iFrame code
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[mermaidAPI.ts:266](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L266)
|
[mermaidAPI.ts:287](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L287)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -314,4 +319,4 @@ Remove any existing elements from the given document
|
|||||||
|
|
||||||
#### Defined in
|
#### Defined in
|
||||||
|
|
||||||
[mermaidAPI.ts:337](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L337)
|
[mermaidAPI.ts:358](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L358)
|
||||||
|
@ -59,7 +59,7 @@ Example:
|
|||||||
|
|
||||||
```html
|
```html
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@9/dist/mermaid.esm.min.mjs';
|
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
|
||||||
mermaid.initialize({ startOnLoad: true });
|
mermaid.initialize({ startOnLoad: true });
|
||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
@ -82,7 +82,7 @@ Example:
|
|||||||
B-->D(fa:fa-spinner);
|
B-->D(fa:fa-spinner);
|
||||||
</pre>
|
</pre>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@9/dist/mermaid.esm.min.mjs';
|
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
|
||||||
mermaid.initialize({ startOnLoad: true });
|
mermaid.initialize({ startOnLoad: true });
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
@ -331,8 +331,8 @@ The future proof way of setting the configuration is by using the initialization
|
|||||||
on what kind of integration you use.
|
on what kind of integration you use.
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<script src="../dist/mermaid.js"></script>
|
<script type="module">
|
||||||
<script>
|
import mermaid from './mermaid.esm.mjs';
|
||||||
let config = { startOnLoad: true, flowchart: { useMaxWidth: false, htmlLabels: true } };
|
let config = { startOnLoad: true, flowchart: { useMaxWidth: false, htmlLabels: true } };
|
||||||
mermaid.initialize(config);
|
mermaid.initialize(config);
|
||||||
</script>
|
</script>
|
||||||
|
@ -249,7 +249,7 @@ To select a version:
|
|||||||
|
|
||||||
Replace `<version>` with the desired version number.
|
Replace `<version>` with the desired version number.
|
||||||
|
|
||||||
Latest Version: <https://cdn.jsdelivr.net/npm/mermaid@9>
|
Latest Version: <https://cdn.jsdelivr.net/npm/mermaid@10>
|
||||||
|
|
||||||
## Deploying Mermaid
|
## Deploying Mermaid
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ To Deploy Mermaid:
|
|||||||
|
|
||||||
```html
|
```html
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@9/dist/mermaid.esm.min.mjs';
|
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
|
||||||
mermaid.initialize({ startOnLoad: true });
|
mermaid.initialize({ startOnLoad: true });
|
||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
@ -128,14 +128,14 @@ b. The importing of mermaid library through the `mermaid.esm.js` or `mermaid.esm
|
|||||||
```html
|
```html
|
||||||
<body>
|
<body>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@9/dist/mermaid.esm.min.mjs';
|
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
|
||||||
mermaid.initialize({ startOnLoad: true });
|
mermaid.initialize({ startOnLoad: true });
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
```
|
```
|
||||||
|
|
||||||
**Notes**:
|
**Notes**:
|
||||||
Rendering in Mermaid is initialized by `mermaid.initialize()` call. You can place `mermaid.initialize()` inside `mermaid.min.js` for brevity. However, doing the opposite lets you control when it starts looking for `<div>`tags inside the web page with `mermaid.initialize()`. This is useful when you think that not all `<div>` tags may have loaded on the execution of `mermaid.min.js` file.
|
Rendering in Mermaid is initialized by `mermaid.initialize()` call. You can place `mermaid.initialize()` inside `mermaid.esm.min.mjs` for brevity. However, doing the opposite lets you control when it starts looking for `<div>`tags inside the web page with `mermaid.initialize()`. This is useful when you think that not all `<div>` tags may have loaded on the execution of `mermaid.esm.min.mjs` file.
|
||||||
|
|
||||||
`startOnLoad` is one of the parameters that can be defined by `mermaid.initialize()`
|
`startOnLoad` is one of the parameters that can be defined by `mermaid.initialize()`
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ Please refer to the [Mindmap](../syntax/mindmap.md?id=integrating-with-your-libr
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@9/dist/mermaid.esm.min.mjs';
|
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
|
||||||
mermaid.initialize({ startOnLoad: true });
|
mermaid.initialize({ startOnLoad: true });
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
@ -391,6 +391,20 @@ flowchart LR
|
|||||||
A == text ==> B
|
A == text ==> B
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### An invisible link
|
||||||
|
|
||||||
|
This can be a useful tool in some instances where you want to alter the default positioning of a node.
|
||||||
|
|
||||||
|
```mermaid-example
|
||||||
|
flowchart LR
|
||||||
|
A ~~~ B
|
||||||
|
```
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
A ~~~ B
|
||||||
|
```
|
||||||
|
|
||||||
### Chaining of links
|
### Chaining of links
|
||||||
|
|
||||||
It is possible declare many links in the same line as per below:
|
It is possible declare many links in the same line as per below:
|
||||||
|
@ -262,7 +262,7 @@ You can still use the pre 9.4.0 method to add mermaid with mindmaps to a web pag
|
|||||||
|
|
||||||
```html
|
```html
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@9/dist/mermaid.esm.min.mjs';
|
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@9.3.0/dist/mermaid.esm.min.mjs';
|
||||||
import mindmap from 'https://cdn.jsdelivr.net/npm/@mermaid-js/mermaid-mindmap@9.3.0/dist/mermaid-mindmap.esm.min.mjs';
|
import mindmap from 'https://cdn.jsdelivr.net/npm/@mermaid-js/mermaid-mindmap@9.3.0/dist/mermaid-mindmap.esm.min.mjs';
|
||||||
await mermaid.registerExternalDiagrams([mindmap]);
|
await mermaid.registerExternalDiagrams([mindmap]);
|
||||||
</script>
|
</script>
|
||||||
@ -272,16 +272,8 @@ From version 9.4.0 you can simplify this code to:
|
|||||||
|
|
||||||
```html
|
```html
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@9/dist/mermaid.esm.min.mjs';
|
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
|
||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
or if you prefer not using the ESM package:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/mermaid@9/dist/mermaid.min.js"></script>
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that more complex integrations that use the **render** function directly need to use the **renderAsync** method instead in order to render mind maps.
|
|
||||||
|
|
||||||
You can also refer the implementation in the live editor [here](https://github.com/mermaid-js/mermaid-live-editor/blob/develop/src/lib/util/mermaid.ts) to see how the async loading is done.
|
You can also refer the implementation in the live editor [here](https://github.com/mermaid-js/mermaid-live-editor/blob/develop/src/lib/util/mermaid.ts) to see how the async loading is done.
|
||||||
|
@ -466,9 +466,9 @@ Timeline uses experimental lazy loading & async rendering features which could c
|
|||||||
You can use this method to add mermaid including the timeline diagram to a web page:
|
You can use this method to add mermaid including the timeline diagram to a web page:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<script src="https://cdn.jsdelivr.net/npm/mermaid@9/dist/mermaid.min.js"></script>
|
<script type="module">
|
||||||
|
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
|
||||||
|
</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that more complex integrations that the **render** function directly need to use the **renderAsync** method instead in order to render timeline.
|
|
||||||
|
|
||||||
You can also refer the implementation in the live editor [here](https://github.com/mermaid-js/mermaid-live-editor/blob/develop/src/lib/util/mermaid.ts) to see how the async loading is done.
|
You can also refer the implementation in the live editor [here](https://github.com/mermaid-js/mermaid-live-editor/blob/develop/src/lib/util/mermaid.ts) to see how the async loading is done.
|
||||||
|
12
package.json
12
package.json
@ -34,7 +34,7 @@
|
|||||||
"test:watch": "vitest --watch",
|
"test:watch": "vitest --watch",
|
||||||
"test:coverage": "vitest --coverage",
|
"test:coverage": "vitest --coverage",
|
||||||
"prepublishOnly": "pnpm build && pnpm test",
|
"prepublishOnly": "pnpm build && pnpm test",
|
||||||
"prepare": "concurrently \"husky install\" \"pnpm build\"",
|
"prepare": "husky install && pnpm build",
|
||||||
"pre-commit": "lint-staged"
|
"pre-commit": "lint-staged"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@ -58,8 +58,9 @@
|
|||||||
"@commitlint/cli": "^17.2.0",
|
"@commitlint/cli": "^17.2.0",
|
||||||
"@commitlint/config-conventional": "^17.2.0",
|
"@commitlint/config-conventional": "^17.2.0",
|
||||||
"@cspell/eslint-plugin": "^6.14.2",
|
"@cspell/eslint-plugin": "^6.14.2",
|
||||||
|
"@types/cors": "^2.8.13",
|
||||||
"@types/eslint": "^8.4.10",
|
"@types/eslint": "^8.4.10",
|
||||||
"@types/express": "^4.17.14",
|
"@types/express": "^4.17.17",
|
||||||
"@types/js-yaml": "^4.0.5",
|
"@types/js-yaml": "^4.0.5",
|
||||||
"@types/jsdom": "^21.0.0",
|
"@types/jsdom": "^21.0.0",
|
||||||
"@types/lodash": "^4.14.188",
|
"@types/lodash": "^4.14.188",
|
||||||
@ -73,6 +74,7 @@
|
|||||||
"@vitest/spy": "^0.28.4",
|
"@vitest/spy": "^0.28.4",
|
||||||
"@vitest/ui": "^0.28.4",
|
"@vitest/ui": "^0.28.4",
|
||||||
"concurrently": "^7.5.0",
|
"concurrently": "^7.5.0",
|
||||||
|
"cors": "^2.8.5",
|
||||||
"coveralls": "^3.1.1",
|
"coveralls": "^3.1.1",
|
||||||
"cypress": "^12.0.0",
|
"cypress": "^12.0.0",
|
||||||
"cypress-image-snapshot": "^4.0.1",
|
"cypress-image-snapshot": "^4.0.1",
|
||||||
@ -103,11 +105,11 @@
|
|||||||
"prettier-plugin-jsdoc": "^0.4.2",
|
"prettier-plugin-jsdoc": "^0.4.2",
|
||||||
"rimraf": "^4.0.0",
|
"rimraf": "^4.0.0",
|
||||||
"rollup-plugin-visualizer": "^5.8.3",
|
"rollup-plugin-visualizer": "^5.8.3",
|
||||||
"start-server-and-test": "^1.14.0",
|
"start-server-and-test": "^1.15.4",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^4.8.4",
|
"typescript": "^4.8.4",
|
||||||
"vite": "^4.0.0",
|
"vite": "^4.1.1",
|
||||||
"vitest": "^0.28.4"
|
"vitest": "^0.28.5"
|
||||||
},
|
},
|
||||||
"volta": {
|
"volta": {
|
||||||
"node": "18.14.0"
|
"node": "18.14.0"
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "mermaid",
|
"name": "mermaid",
|
||||||
"version": "9.4.0",
|
"version": "10.0.0",
|
||||||
"description": "Markdown-ish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.",
|
"description": "Markdown-ish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.",
|
||||||
"main": "./dist/mermaid.min.js",
|
"type": "module",
|
||||||
"module": "./dist/mermaid.core.mjs",
|
"module": "./dist/mermaid.core.mjs",
|
||||||
"types": "./dist/mermaid.d.ts",
|
"types": "./dist/mermaid.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"require": "./dist/mermaid.min.js",
|
|
||||||
"import": "./dist/mermaid.core.mjs",
|
"import": "./dist/mermaid.core.mjs",
|
||||||
"types": "./dist/mermaid.d.ts"
|
"types": "./dist/mermaid.d.ts"
|
||||||
},
|
},
|
||||||
@ -56,13 +55,13 @@
|
|||||||
"cytoscape": "^3.23.0",
|
"cytoscape": "^3.23.0",
|
||||||
"cytoscape-cose-bilkent": "^4.1.0",
|
"cytoscape-cose-bilkent": "^4.1.0",
|
||||||
"cytoscape-fcose": "^2.1.0",
|
"cytoscape-fcose": "^2.1.0",
|
||||||
"d3": "^7.0.0",
|
"d3": "^7.4.0",
|
||||||
"dagre-d3-es": "7.0.8",
|
"dagre-d3-es": "7.0.8",
|
||||||
"dompurify": "2.4.3",
|
"dompurify": "2.4.3",
|
||||||
"elkjs": "^0.8.2",
|
"elkjs": "^0.8.2",
|
||||||
"khroma": "^2.0.0",
|
"khroma": "^2.0.0",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"moment": "^2.29.4",
|
"moment-mini": "^2.29.4",
|
||||||
"non-layered-tidy-tree-layout": "^2.0.2",
|
"non-layered-tidy-tree-layout": "^2.0.2",
|
||||||
"stylis": "^4.1.2",
|
"stylis": "^4.1.2",
|
||||||
"ts-dedent": "^2.2.0",
|
"ts-dedent": "^2.2.0",
|
||||||
@ -109,8 +108,5 @@
|
|||||||
"dist",
|
"dist",
|
||||||
"README.md"
|
"README.md"
|
||||||
],
|
],
|
||||||
"sideEffects": [
|
"sideEffects": false
|
||||||
"**/*.css",
|
|
||||||
"**/*.scss"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
@ -3,26 +3,24 @@ import { log } from './logger';
|
|||||||
import { getDiagram, registerDiagram } from './diagram-api/diagramAPI';
|
import { getDiagram, registerDiagram } from './diagram-api/diagramAPI';
|
||||||
import { detectType, getDiagramLoader } from './diagram-api/detectType';
|
import { detectType, getDiagramLoader } from './diagram-api/detectType';
|
||||||
import { extractFrontMatter } from './diagram-api/frontmatter';
|
import { extractFrontMatter } from './diagram-api/frontmatter';
|
||||||
import { isDetailedError } from './utils';
|
import { UnknownDiagramError } from './errors';
|
||||||
import type { DetailedError } from './utils';
|
import { DetailedError } from './utils';
|
||||||
|
|
||||||
export type ParseErrorFunction = (err: string | DetailedError | unknown, hash?: any) => void;
|
export type ParseErrorFunction = (err: string | DetailedError | unknown, hash?: any) => void;
|
||||||
|
|
||||||
export class Diagram {
|
export class Diagram {
|
||||||
type = 'graph';
|
type = 'graph';
|
||||||
parser;
|
parser;
|
||||||
renderer;
|
renderer;
|
||||||
db;
|
db;
|
||||||
private detectTypeFailed = false;
|
private detectError?: UnknownDiagramError;
|
||||||
constructor(public txt: string, parseError?: ParseErrorFunction) {
|
constructor(public text: string) {
|
||||||
|
this.text += '\n';
|
||||||
const cnf = configApi.getConfig();
|
const cnf = configApi.getConfig();
|
||||||
this.txt = txt;
|
|
||||||
try {
|
try {
|
||||||
this.type = detectType(txt, cnf);
|
this.type = detectType(text, cnf);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.handleError(e, parseError);
|
|
||||||
this.type = 'error';
|
this.type = 'error';
|
||||||
this.detectTypeFailed = true;
|
this.detectError = e as UnknownDiagramError;
|
||||||
}
|
}
|
||||||
const diagram = getDiagram(this.type);
|
const diagram = getDiagram(this.type);
|
||||||
log.debug('Type ' + this.type);
|
log.debug('Type ' + this.type);
|
||||||
@ -46,44 +44,19 @@ export class Diagram {
|
|||||||
diagram.init(cnf);
|
diagram.init(cnf);
|
||||||
log.info('Initialized diagram ' + this.type, cnf);
|
log.info('Initialized diagram ' + this.type, cnf);
|
||||||
}
|
}
|
||||||
this.txt += '\n';
|
this.parse();
|
||||||
|
|
||||||
this.parse(this.txt, parseError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parse(text: string, parseError?: ParseErrorFunction): boolean {
|
parse() {
|
||||||
if (this.detectTypeFailed) {
|
if (this.detectError) {
|
||||||
return false;
|
throw this.detectError;
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
text = text + '\n';
|
|
||||||
this.db.clear?.();
|
this.db.clear?.();
|
||||||
this.parser.parse(text);
|
this.parser.parse(this.text);
|
||||||
return true;
|
|
||||||
} catch (error) {
|
|
||||||
this.handleError(error, parseError);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleError(error: unknown, parseError?: ParseErrorFunction) {
|
async render(id: string, version: string) {
|
||||||
// Is this the correct way to access mermaid's parseError()
|
await this.renderer.draw(this.text, id, version, this);
|
||||||
// method ? (or global.mermaid.parseError()) ?
|
|
||||||
|
|
||||||
if (parseError === undefined) {
|
|
||||||
// No mermaid.parseError() handler defined, so re-throw it
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isDetailedError(error)) {
|
|
||||||
// Handle case where error string and hash were
|
|
||||||
// wrapped in object like`const error = { str, hash };`
|
|
||||||
parseError(error.str, error.hash);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise, assume it is just an error string and pass it on
|
|
||||||
parseError(error as string);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getParser() {
|
getParser() {
|
||||||
@ -95,30 +68,20 @@ export class Diagram {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getDiagramFromText = (
|
export const getDiagramFromText = async (text: string): Promise<Diagram> => {
|
||||||
txt: string,
|
const type = detectType(text, configApi.getConfig());
|
||||||
parseError?: ParseErrorFunction
|
|
||||||
): Diagram | Promise<Diagram> => {
|
|
||||||
const type = detectType(txt, configApi.getConfig());
|
|
||||||
try {
|
try {
|
||||||
// Trying to find the diagram
|
// Trying to find the diagram
|
||||||
getDiagram(type);
|
getDiagram(type);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const loader = getDiagramLoader(type);
|
const loader = getDiagramLoader(type);
|
||||||
if (!loader) {
|
if (!loader) {
|
||||||
throw new Error(`Diagram ${type} not found.`);
|
throw new UnknownDiagramError(`Diagram ${type} not found.`);
|
||||||
}
|
}
|
||||||
// TODO: Uncomment for v10
|
// Diagram not available, loading it.
|
||||||
// // Diagram not available, loading it
|
// new diagram will try getDiagram again and if fails then it is a valid throw
|
||||||
// const { diagram } = await loader();
|
const { id, diagram } = await loader();
|
||||||
// registerDiagram(type, diagram, undefined, diagram.injectUtils);
|
registerDiagram(id, diagram);
|
||||||
// // new diagram will try getDiagram again and if fails then it is a valid throw
|
|
||||||
return loader().then(({ diagram }) => {
|
|
||||||
registerDiagram(type, diagram, undefined);
|
|
||||||
return new Diagram(txt, parseError);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return new Diagram(txt, parseError);
|
return new Diagram(text);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Diagram;
|
|
||||||
|
@ -5,24 +5,14 @@
|
|||||||
*/
|
*/
|
||||||
import * as configApi from '../config';
|
import * as configApi from '../config';
|
||||||
import { vi } from 'vitest';
|
import { vi } from 'vitest';
|
||||||
import { addDiagrams } from '../diagram-api/diagram-orchestration';
|
import { mermaidAPI as mAPI } from '../mermaidAPI';
|
||||||
import Diagram, { type ParseErrorFunction } from '../Diagram';
|
|
||||||
|
|
||||||
// Normally, we could just do the following to get the original `parse()`
|
|
||||||
// implementation, however, requireActual returns a promise and it's not documented how to use withing mock file.
|
|
||||||
|
|
||||||
/** {@inheritDoc mermaidAPI.parse} */
|
|
||||||
function parse(text: string, parseError?: ParseErrorFunction): boolean {
|
|
||||||
addDiagrams();
|
|
||||||
const diagram = new Diagram(text, parseError);
|
|
||||||
return diagram.parse(text, parseError);
|
|
||||||
}
|
|
||||||
|
|
||||||
// original version cannot be modified since it was frozen with `Object.freeze()`
|
// original version cannot be modified since it was frozen with `Object.freeze()`
|
||||||
export const mermaidAPI = {
|
export const mermaidAPI = {
|
||||||
render: vi.fn(),
|
render: vi.fn().mockResolvedValue({
|
||||||
renderAsync: vi.fn(),
|
svg: '<svg></svg>',
|
||||||
parse,
|
}),
|
||||||
|
parse: mAPI.parse,
|
||||||
parseDirective: vi.fn(),
|
parseDirective: vi.fn(),
|
||||||
initialize: vi.fn(),
|
initialize: vi.fn(),
|
||||||
getConfig: configApi.getConfig,
|
getConfig: configApi.getConfig,
|
||||||
|
@ -243,6 +243,7 @@ const checkConfig = (config: MermaidConfig) => {
|
|||||||
if (!config) {
|
if (!config) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// @ts-expect-error Properties were removed in v10. Warning should exist.
|
||||||
if (config.lazyLoadedDiagrams || config.loadExternalDiagramsAtStartup) {
|
if (config.lazyLoadedDiagrams || config.loadExternalDiagramsAtStartup) {
|
||||||
issueWarning('LAZY_LOAD_DEPRECATED');
|
issueWarning('LAZY_LOAD_DEPRECATED');
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,6 @@
|
|||||||
import DOMPurify from 'dompurify';
|
import DOMPurify from 'dompurify';
|
||||||
|
|
||||||
export interface MermaidConfig {
|
export interface MermaidConfig {
|
||||||
/** @deprecated use mermaid.registerLazyDiagrams instead */
|
|
||||||
lazyLoadedDiagrams?: string[];
|
|
||||||
/** @deprecated use mermaid.registerLazyDiagrams instead */
|
|
||||||
loadExternalDiagramsAtStartup?: boolean;
|
|
||||||
theme?: string;
|
theme?: string;
|
||||||
themeVariables?: any;
|
themeVariables?: any;
|
||||||
themeCSS?: string;
|
themeCSS?: string;
|
||||||
|
@ -453,6 +453,9 @@ export const insertEdge = function (elem, e, edge, clusterDb, diagramType, graph
|
|||||||
case 'thick':
|
case 'thick':
|
||||||
strokeClasses = 'edge-thickness-thick';
|
strokeClasses = 'edge-thickness-thick';
|
||||||
break;
|
break;
|
||||||
|
case 'invisible':
|
||||||
|
strokeClasses = 'edge-thickness-thick';
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
strokeClasses = '';
|
strokeClasses = '';
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@ import type {
|
|||||||
ExternalDiagramDefinition,
|
ExternalDiagramDefinition,
|
||||||
} from './types';
|
} from './types';
|
||||||
import { frontMatterRegex } from './frontmatter';
|
import { frontMatterRegex } from './frontmatter';
|
||||||
|
import { getDiagram, registerDiagram } from './diagramAPI';
|
||||||
|
import { UnknownDiagramError } from '../errors';
|
||||||
|
|
||||||
const directive = /%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
|
const directive = /%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
|
||||||
const anyComment = /\s*%%.*\n/gm;
|
const anyComment = /\s*%%.*\n/gm;
|
||||||
@ -44,7 +46,7 @@ export const detectType = function (text: string, config?: MermaidConfig): strin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error(`No diagram type detected for text: ${text}`);
|
throw new UnknownDiagramError(`No diagram type detected for text: ${text}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const registerLazyLoadedDiagrams = (...diagrams: ExternalDiagramDefinition[]) => {
|
export const registerLazyLoadedDiagrams = (...diagrams: ExternalDiagramDefinition[]) => {
|
||||||
@ -53,6 +55,39 @@ export const registerLazyLoadedDiagrams = (...diagrams: ExternalDiagramDefinitio
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const loadRegisteredDiagrams = async () => {
|
||||||
|
log.debug(`Loading registered diagrams`);
|
||||||
|
// Load all lazy loaded diagrams in parallel
|
||||||
|
const results = await Promise.allSettled(
|
||||||
|
Object.entries(detectors).map(async ([key, { detector, loader }]) => {
|
||||||
|
if (loader) {
|
||||||
|
try {
|
||||||
|
getDiagram(key);
|
||||||
|
} catch (error) {
|
||||||
|
try {
|
||||||
|
// Register diagram if it is not already registered
|
||||||
|
const { diagram, id } = await loader();
|
||||||
|
registerDiagram(id, diagram, detector);
|
||||||
|
} catch (err) {
|
||||||
|
// Remove failed diagram from detectors
|
||||||
|
log.error(`Failed to load external diagram with key ${key}. Removing from detectors.`);
|
||||||
|
delete detectors[key];
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
const failed = results.filter((result) => result.status === 'rejected');
|
||||||
|
if (failed.length > 0) {
|
||||||
|
log.error(`Failed to load ${failed.length} external diagrams`);
|
||||||
|
for (const res of failed) {
|
||||||
|
log.error(res);
|
||||||
|
}
|
||||||
|
throw new Error(`Failed to load ${failed.length} external diagrams`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export const addDetector = (key: string, detector: DiagramDetector, loader?: DiagramLoader) => {
|
export const addDetector = (key: string, detector: DiagramDetector, loader?: DiagramLoader) => {
|
||||||
if (detectors[key]) {
|
if (detectors[key]) {
|
||||||
log.error(`Detector with key ${key} already exists`);
|
log.error(`Detector with key ${key} already exists`);
|
||||||
|
@ -1,104 +1,24 @@
|
|||||||
import { registerDiagram } from './diagramAPI';
|
import c4 from '../diagrams/c4/c4Detector';
|
||||||
// @ts-ignore: TODO Fix ts errors
|
import flowchart from '../diagrams/flowchart/flowDetector';
|
||||||
import gitGraphParser from '../diagrams/git/parser/gitGraph';
|
import flowchartV2 from '../diagrams/flowchart/flowDetector-v2';
|
||||||
import { gitGraphDetector } from '../diagrams/git/gitGraphDetector';
|
import er from '../diagrams/er/erDetector';
|
||||||
import gitGraphDb from '../diagrams/git/gitGraphAst';
|
import git from '../diagrams/git/gitGraphDetector';
|
||||||
import gitGraphRenderer from '../diagrams/git/gitGraphRenderer';
|
import gantt from '../diagrams/gantt/ganttDetector';
|
||||||
import gitGraphStyles from '../diagrams/git/styles';
|
import info from '../diagrams/info/infoDetector';
|
||||||
|
import pie from '../diagrams/pie/pieDetector';
|
||||||
// @ts-ignore: TODO Fix ts errors
|
import requirement from '../diagrams/requirement/requirementDetector';
|
||||||
import c4Parser from '../diagrams/c4/parser/c4Diagram';
|
import sequence from '../diagrams/sequence/sequenceDetector';
|
||||||
import { c4Detector } from '../diagrams/c4/c4Detector';
|
import classDiagram from '../diagrams/class/classDetector';
|
||||||
import c4Db from '../diagrams/c4/c4Db';
|
import classDiagramV2 from '../diagrams/class/classDetector-V2';
|
||||||
import c4Renderer from '../diagrams/c4/c4Renderer';
|
import state from '../diagrams/state/stateDetector';
|
||||||
import c4Styles from '../diagrams/c4/styles';
|
import stateV2 from '../diagrams/state/stateDetector-V2';
|
||||||
|
import journey from '../diagrams/user-journey/journeyDetector';
|
||||||
// @ts-ignore: TODO Fix ts errors
|
import error from '../diagrams/error/errorDetector';
|
||||||
import classParser from '../diagrams/class/parser/classDiagram';
|
|
||||||
import { classDetector } from '../diagrams/class/classDetector';
|
|
||||||
import { classDetectorV2 } from '../diagrams/class/classDetector-V2';
|
|
||||||
import classDb from '../diagrams/class/classDb';
|
|
||||||
import classRenderer from '../diagrams/class/classRenderer';
|
|
||||||
import classRendererV2 from '../diagrams/class/classRenderer-v2';
|
|
||||||
import classStyles from '../diagrams/class/styles';
|
|
||||||
|
|
||||||
// @ts-ignore: TODO Fix ts errors
|
|
||||||
import erParser from '../diagrams/er/parser/erDiagram';
|
|
||||||
import { erDetector } from '../diagrams/er/erDetector';
|
|
||||||
import erDb from '../diagrams/er/erDb';
|
|
||||||
import erRenderer from '../diagrams/er/erRenderer';
|
|
||||||
import erStyles from '../diagrams/er/styles';
|
|
||||||
|
|
||||||
// @ts-ignore: TODO Fix ts errors
|
|
||||||
import flowParser from '../diagrams/flowchart/parser/flow';
|
|
||||||
import { flowDetector } from '../diagrams/flowchart/flowDetector';
|
|
||||||
import { flowDetectorV2 } from '../diagrams/flowchart/flowDetector-v2';
|
|
||||||
import flowDb from '../diagrams/flowchart/flowDb';
|
|
||||||
import flowRenderer from '../diagrams/flowchart/flowRenderer';
|
|
||||||
import flowRendererV2 from '../diagrams/flowchart/flowRenderer-v2';
|
|
||||||
import flowStyles from '../diagrams/flowchart/styles';
|
|
||||||
|
|
||||||
// @ts-ignore: TODO Fix ts errors
|
|
||||||
import ganttParser from '../diagrams/gantt/parser/gantt';
|
|
||||||
import { ganttDetector } from '../diagrams/gantt/ganttDetector';
|
|
||||||
import ganttDb from '../diagrams/gantt/ganttDb';
|
|
||||||
import ganttRenderer from '../diagrams/gantt/ganttRenderer';
|
|
||||||
import ganttStyles from '../diagrams/gantt/styles';
|
|
||||||
|
|
||||||
// @ts-ignore: TODO Fix ts errors
|
|
||||||
import infoParser from '../diagrams/info/parser/info';
|
|
||||||
import infoDb from '../diagrams/info/infoDb';
|
|
||||||
import infoRenderer from '../diagrams/info/infoRenderer';
|
|
||||||
import { infoDetector } from '../diagrams/info/infoDetector';
|
|
||||||
import infoStyles from '../diagrams/info/styles';
|
|
||||||
|
|
||||||
// @ts-ignore: TODO Fix ts errors
|
|
||||||
import pieParser from '../diagrams/pie/parser/pie';
|
|
||||||
import { pieDetector } from '../diagrams/pie/pieDetector';
|
|
||||||
import pieDb from '../diagrams/pie/pieDb';
|
|
||||||
import pieRenderer from '../diagrams/pie/pieRenderer';
|
|
||||||
import pieStyles from '../diagrams/pie/styles';
|
|
||||||
|
|
||||||
// @ts-ignore: TODO Fix ts errors
|
|
||||||
import requirementParser from '../diagrams/requirement/parser/requirementDiagram';
|
|
||||||
import { requirementDetector } from '../diagrams/requirement/requirementDetector';
|
|
||||||
import requirementDb from '../diagrams/requirement/requirementDb';
|
|
||||||
import requirementRenderer from '../diagrams/requirement/requirementRenderer';
|
|
||||||
import requirementStyles from '../diagrams/requirement/styles';
|
|
||||||
|
|
||||||
// @ts-ignore: TODO Fix ts errors
|
|
||||||
import sequenceParser from '../diagrams/sequence/parser/sequenceDiagram';
|
|
||||||
import { sequenceDetector } from '../diagrams/sequence/sequenceDetector';
|
|
||||||
import sequenceDb from '../diagrams/sequence/sequenceDb';
|
|
||||||
import sequenceRenderer from '../diagrams/sequence/sequenceRenderer';
|
|
||||||
import sequenceStyles from '../diagrams/sequence/styles';
|
|
||||||
|
|
||||||
// @ts-ignore: TODO Fix ts errors
|
|
||||||
import stateParser from '../diagrams/state/parser/stateDiagram';
|
|
||||||
import { stateDetector } from '../diagrams/state/stateDetector';
|
|
||||||
import { stateDetectorV2 } from '../diagrams/state/stateDetector-V2';
|
|
||||||
import stateDb from '../diagrams/state/stateDb';
|
|
||||||
import stateRenderer from '../diagrams/state/stateRenderer';
|
|
||||||
import stateRendererV2 from '../diagrams/state/stateRenderer-v2';
|
|
||||||
import stateStyles from '../diagrams/state/styles';
|
|
||||||
|
|
||||||
// @ts-ignore: TODO Fix ts errors
|
|
||||||
import journeyParser from '../diagrams/user-journey/parser/journey';
|
|
||||||
import { journeyDetector } from '../diagrams/user-journey/journeyDetector';
|
|
||||||
import journeyDb from '../diagrams/user-journey/journeyDb';
|
|
||||||
import journeyRenderer from '../diagrams/user-journey/journeyRenderer';
|
|
||||||
import journeyStyles from '../diagrams/user-journey/styles';
|
|
||||||
import { setConfig } from '../config';
|
|
||||||
|
|
||||||
import errorRenderer from '../diagrams/error/errorRenderer';
|
|
||||||
import errorStyles from '../diagrams/error/styles';
|
|
||||||
|
|
||||||
import flowchartElk from '../diagrams/flowchart/elk/detector';
|
import flowchartElk from '../diagrams/flowchart/elk/detector';
|
||||||
|
import timeline from '../diagrams/timeline/detector';
|
||||||
|
import mindmap from '../diagrams/mindmap/detector';
|
||||||
import { registerLazyLoadedDiagrams } from './detectType';
|
import { registerLazyLoadedDiagrams } from './detectType';
|
||||||
|
import { registerDiagram } from './diagramAPI';
|
||||||
// Lazy loaded diagrams
|
|
||||||
import timelineDetector from '../diagrams/timeline/detector';
|
|
||||||
import mindmapDetector from '../diagrams/mindmap/detector';
|
|
||||||
|
|
||||||
let hasLoadedDiagrams = false;
|
let hasLoadedDiagrams = false;
|
||||||
export const addDiagrams = () => {
|
export const addDiagrams = () => {
|
||||||
@ -108,31 +28,6 @@ export const addDiagrams = () => {
|
|||||||
// This is added here to avoid race-conditions.
|
// This is added here to avoid race-conditions.
|
||||||
// We could optimize the loading logic somehow.
|
// We could optimize the loading logic somehow.
|
||||||
hasLoadedDiagrams = true;
|
hasLoadedDiagrams = true;
|
||||||
registerLazyLoadedDiagrams(flowchartElk, timelineDetector, mindmapDetector);
|
|
||||||
|
|
||||||
registerDiagram(
|
|
||||||
'error',
|
|
||||||
// Special diagram with error messages but setup as a regular diagram
|
|
||||||
{
|
|
||||||
db: {
|
|
||||||
clear: () => {
|
|
||||||
// Quite ok, clear needs to be there for error to work as a regular diagram
|
|
||||||
},
|
|
||||||
},
|
|
||||||
styles: errorStyles,
|
|
||||||
renderer: errorRenderer,
|
|
||||||
parser: {
|
|
||||||
parser: { yy: {} },
|
|
||||||
parse: () => {
|
|
||||||
// no op
|
|
||||||
},
|
|
||||||
},
|
|
||||||
init: () => {
|
|
||||||
// no op
|
|
||||||
},
|
|
||||||
},
|
|
||||||
(text) => text.toLowerCase().trim() === 'error'
|
|
||||||
);
|
|
||||||
registerDiagram(
|
registerDiagram(
|
||||||
'---',
|
'---',
|
||||||
// --- diagram type may appear if YAML front-matter is not parsed correctly
|
// --- diagram type may appear if YAML front-matter is not parsed correctly
|
||||||
@ -142,8 +37,8 @@ export const addDiagrams = () => {
|
|||||||
// Quite ok, clear needs to be there for --- to work as a regular diagram
|
// Quite ok, clear needs to be there for --- to work as a regular diagram
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
styles: errorStyles, // should never be used
|
styles: {}, // should never be used
|
||||||
renderer: errorRenderer, // should never be used
|
renderer: {}, // should never be used
|
||||||
parser: {
|
parser: {
|
||||||
parser: { yy: {} },
|
parser: { yy: {} },
|
||||||
parse: () => {
|
parse: () => {
|
||||||
@ -160,220 +55,25 @@ export const addDiagrams = () => {
|
|||||||
return text.toLowerCase().trimStart().startsWith('---');
|
return text.toLowerCase().trimStart().startsWith('---');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
registerLazyLoadedDiagrams(
|
||||||
registerDiagram(
|
error,
|
||||||
'c4',
|
c4,
|
||||||
{
|
classDiagram,
|
||||||
parser: c4Parser,
|
classDiagramV2,
|
||||||
db: c4Db,
|
er,
|
||||||
renderer: c4Renderer,
|
gantt,
|
||||||
styles: c4Styles,
|
info,
|
||||||
init: (cnf) => {
|
pie,
|
||||||
c4Renderer.setConf(cnf.c4);
|
requirement,
|
||||||
},
|
sequence,
|
||||||
},
|
flowchart,
|
||||||
c4Detector
|
flowchartV2,
|
||||||
);
|
flowchartElk,
|
||||||
registerDiagram(
|
mindmap,
|
||||||
'class',
|
timeline,
|
||||||
{
|
git,
|
||||||
parser: classParser,
|
state,
|
||||||
db: classDb,
|
stateV2,
|
||||||
renderer: classRenderer,
|
journey
|
||||||
styles: classStyles,
|
|
||||||
init: (cnf) => {
|
|
||||||
if (!cnf.class) {
|
|
||||||
cnf.class = {};
|
|
||||||
}
|
|
||||||
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
||||||
classDb.clear();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
classDetector
|
|
||||||
);
|
|
||||||
registerDiagram(
|
|
||||||
'classDiagram',
|
|
||||||
{
|
|
||||||
parser: classParser,
|
|
||||||
db: classDb,
|
|
||||||
renderer: classRendererV2,
|
|
||||||
styles: classStyles,
|
|
||||||
init: (cnf) => {
|
|
||||||
if (!cnf.class) {
|
|
||||||
cnf.class = {};
|
|
||||||
}
|
|
||||||
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
||||||
classDb.clear();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
classDetectorV2
|
|
||||||
);
|
|
||||||
registerDiagram(
|
|
||||||
'er',
|
|
||||||
{
|
|
||||||
parser: erParser,
|
|
||||||
db: erDb,
|
|
||||||
renderer: erRenderer,
|
|
||||||
styles: erStyles,
|
|
||||||
},
|
|
||||||
erDetector
|
|
||||||
);
|
|
||||||
registerDiagram(
|
|
||||||
'gantt',
|
|
||||||
{
|
|
||||||
parser: ganttParser,
|
|
||||||
db: ganttDb,
|
|
||||||
renderer: ganttRenderer,
|
|
||||||
styles: ganttStyles,
|
|
||||||
},
|
|
||||||
ganttDetector
|
|
||||||
);
|
|
||||||
registerDiagram(
|
|
||||||
'info',
|
|
||||||
{
|
|
||||||
parser: infoParser,
|
|
||||||
db: infoDb,
|
|
||||||
renderer: infoRenderer,
|
|
||||||
styles: infoStyles,
|
|
||||||
},
|
|
||||||
infoDetector
|
|
||||||
);
|
|
||||||
registerDiagram(
|
|
||||||
'pie',
|
|
||||||
{
|
|
||||||
parser: pieParser,
|
|
||||||
db: pieDb,
|
|
||||||
renderer: pieRenderer,
|
|
||||||
styles: pieStyles,
|
|
||||||
},
|
|
||||||
pieDetector
|
|
||||||
);
|
|
||||||
registerDiagram(
|
|
||||||
'requirement',
|
|
||||||
{
|
|
||||||
parser: requirementParser,
|
|
||||||
db: requirementDb,
|
|
||||||
renderer: requirementRenderer,
|
|
||||||
styles: requirementStyles,
|
|
||||||
},
|
|
||||||
requirementDetector
|
|
||||||
);
|
|
||||||
registerDiagram(
|
|
||||||
'sequence',
|
|
||||||
{
|
|
||||||
parser: sequenceParser,
|
|
||||||
db: sequenceDb,
|
|
||||||
renderer: sequenceRenderer,
|
|
||||||
styles: sequenceStyles,
|
|
||||||
init: (cnf) => {
|
|
||||||
if (!cnf.sequence) {
|
|
||||||
cnf.sequence = {};
|
|
||||||
}
|
|
||||||
cnf.sequence.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
||||||
if ('sequenceDiagram' in cnf) {
|
|
||||||
throw new Error(
|
|
||||||
'`mermaid config.sequenceDiagram` has been renamed to `config.sequence`. Please update your mermaid config.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
sequenceDb.setWrap(cnf.wrap);
|
|
||||||
sequenceRenderer.setConf(cnf.sequence);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
sequenceDetector
|
|
||||||
);
|
|
||||||
registerDiagram(
|
|
||||||
'state',
|
|
||||||
{
|
|
||||||
parser: stateParser,
|
|
||||||
db: stateDb,
|
|
||||||
renderer: stateRenderer,
|
|
||||||
styles: stateStyles,
|
|
||||||
init: (cnf) => {
|
|
||||||
if (!cnf.state) {
|
|
||||||
cnf.state = {};
|
|
||||||
}
|
|
||||||
cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
||||||
stateDb.clear();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
stateDetector
|
|
||||||
);
|
|
||||||
registerDiagram(
|
|
||||||
'stateDiagram',
|
|
||||||
{
|
|
||||||
parser: stateParser,
|
|
||||||
db: stateDb,
|
|
||||||
renderer: stateRendererV2,
|
|
||||||
styles: stateStyles,
|
|
||||||
init: (cnf) => {
|
|
||||||
if (!cnf.state) {
|
|
||||||
cnf.state = {};
|
|
||||||
}
|
|
||||||
cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
||||||
stateDb.clear();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
stateDetectorV2
|
|
||||||
);
|
|
||||||
registerDiagram(
|
|
||||||
'journey',
|
|
||||||
{
|
|
||||||
parser: journeyParser,
|
|
||||||
db: journeyDb,
|
|
||||||
renderer: journeyRenderer,
|
|
||||||
styles: journeyStyles,
|
|
||||||
init: (cnf) => {
|
|
||||||
journeyRenderer.setConf(cnf.journey);
|
|
||||||
journeyDb.clear();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
journeyDetector
|
|
||||||
);
|
|
||||||
|
|
||||||
registerDiagram(
|
|
||||||
'flowchart',
|
|
||||||
{
|
|
||||||
parser: flowParser,
|
|
||||||
db: flowDb,
|
|
||||||
renderer: flowRendererV2,
|
|
||||||
styles: flowStyles,
|
|
||||||
init: (cnf) => {
|
|
||||||
if (!cnf.flowchart) {
|
|
||||||
cnf.flowchart = {};
|
|
||||||
}
|
|
||||||
// TODO, broken as of 2022-09-14 (13809b50251845475e6dca65cc395761be38fbd2)
|
|
||||||
cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
||||||
flowRenderer.setConf(cnf.flowchart);
|
|
||||||
flowDb.clear();
|
|
||||||
flowDb.setGen('gen-1');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
flowDetector
|
|
||||||
);
|
|
||||||
registerDiagram(
|
|
||||||
'flowchart-v2',
|
|
||||||
{
|
|
||||||
parser: flowParser,
|
|
||||||
db: flowDb,
|
|
||||||
renderer: flowRendererV2,
|
|
||||||
styles: flowStyles,
|
|
||||||
init: (cnf) => {
|
|
||||||
if (!cnf.flowchart) {
|
|
||||||
cnf.flowchart = {};
|
|
||||||
}
|
|
||||||
cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
||||||
// flowchart-v2 uses dagre-wrapper, which doesn't have access to flowchart cnf
|
|
||||||
setConfig({ flowchart: { arrowMarkerAbsolute: cnf.arrowMarkerAbsolute } });
|
|
||||||
flowRendererV2.setConf(cnf.flowchart);
|
|
||||||
flowDb.clear();
|
|
||||||
flowDb.setGen('gen-2');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
flowDetectorV2
|
|
||||||
);
|
|
||||||
registerDiagram(
|
|
||||||
'gitGraph',
|
|
||||||
{ parser: gitGraphParser, db: gitGraphDb, renderer: gitGraphRenderer, styles: gitGraphStyles },
|
|
||||||
gitGraphDetector
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -2,8 +2,12 @@ import { detectType } from './detectType';
|
|||||||
import { getDiagram, registerDiagram } from './diagramAPI';
|
import { getDiagram, registerDiagram } from './diagramAPI';
|
||||||
import { addDiagrams } from './diagram-orchestration';
|
import { addDiagrams } from './diagram-orchestration';
|
||||||
import { DiagramDetector } from './types';
|
import { DiagramDetector } from './types';
|
||||||
|
import { getDiagramFromText } from '../Diagram';
|
||||||
|
|
||||||
addDiagrams();
|
addDiagrams();
|
||||||
|
beforeAll(async () => {
|
||||||
|
await getDiagramFromText('sequenceDiagram');
|
||||||
|
});
|
||||||
|
|
||||||
describe('DiagramAPI', () => {
|
describe('DiagramAPI', () => {
|
||||||
it('should return default diagrams', () => {
|
it('should return default diagrams', () => {
|
||||||
|
@ -71,3 +71,9 @@ export const getDiagram = (name: string): DiagramDefinition => {
|
|||||||
}
|
}
|
||||||
throw new Error(`Diagram ${name} not found.`);
|
throw new Error(`Diagram ${name} not found.`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export class DiagramNotFoundError extends Error {
|
||||||
|
constructor(message: string) {
|
||||||
|
super(`Diagram ${message} not found.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user