mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-14 22:09:29 +02:00
chore: Merge master to develop
This commit is contained in:
23
tests/webpack/package.json
Normal file
23
tests/webpack/package.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "webpack",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"private": true,
|
||||
"module": "commonjs",
|
||||
"scripts": {
|
||||
"build": "webpack",
|
||||
"serve": "webpack serve"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"webpack": "^5.74.0",
|
||||
"webpack-cli": "^4.10.0",
|
||||
"webpack-dev-server": "^4.11.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"mermaid": "workspace:*",
|
||||
"@mermaid-js/mermaid-mindmap": "workspace:*"
|
||||
}
|
||||
}
|
11
tests/webpack/public/index.html
Normal file
11
tests/webpack/public/index.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Getting Started</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="graphDiv"></div>
|
||||
<script src="./main.js"></script>
|
||||
</body>
|
||||
</html>
|
38
tests/webpack/src/index.js
Normal file
38
tests/webpack/src/index.js
Normal file
@@ -0,0 +1,38 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
/* eslint-disable no-console */
|
||||
const mermaid = require('mermaid');
|
||||
import mindmap from '@mermaid-js/mermaid-mindmap';
|
||||
|
||||
const render = async (graph) => {
|
||||
const svg = await mermaid.renderAsync('dummy', graph);
|
||||
console.log(svg);
|
||||
document.getElementById('graphDiv').innerHTML = svg;
|
||||
};
|
||||
|
||||
const load = async () => {
|
||||
await mermaid.registerExternalDiagrams([mindmap]);
|
||||
await render('info');
|
||||
|
||||
setTimeout(async () => {
|
||||
await render(`mindmap
|
||||
root((mindmap))
|
||||
Origins
|
||||
Long history
|
||||
::icon(fa fa-book)
|
||||
Popularisation
|
||||
British popular psychology author Tony Buzan
|
||||
Research
|
||||
On effectivness<br/>and features
|
||||
On Automatic creation
|
||||
Uses
|
||||
Creative techniques
|
||||
Strategic planning
|
||||
Argument mapping
|
||||
Tools
|
||||
Pen and paper
|
||||
Mermaid
|
||||
`);
|
||||
}, 2500);
|
||||
};
|
||||
|
||||
window.addEventListener('load', load, false);
|
10
tests/webpack/webpack.config.js
Normal file
10
tests/webpack/webpack.config.js
Normal file
@@ -0,0 +1,10 @@
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: './src/index.js',
|
||||
output: {
|
||||
filename: 'main.js',
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
},
|
||||
};
|
Reference in New Issue
Block a user