| 1 | /* eslint-disable no-console */ |
| 2 | // eslint-disable-next-line @typescript-eslint/no-require-imports |
| 3 | const mermaid = require('mermaid'); |
| 4 | import mindmap from '@mermaid-js/mermaid-mindmap'; |
| 5 | |
| 6 | const render = async (graph) => { |
| 7 | const svg = await mermaid.render('dummy', graph); |
| 8 | console.log(svg); |
| 9 | document.getElementById('graphDiv').innerHTML = svg; |
| 10 | }; |
| 11 | |
| 12 | const load = async () => { |
| 13 | await mermaid.registerExternalDiagrams([mindmap]); |
| 14 | await render('info'); |
| 15 | |
| 16 | setTimeout(() => { |
| 17 | void render(`mindmap |
| 18 | root((mindmap)) |
| 19 | Origins |
| 20 | Long history |
| 21 | ::icon(fa fa-book) |
| 22 | Popularisation |
| 23 | British popular psychology author Tony Buzan |
| 24 | Research |
| 25 | On effectiveness<br/>and features |
| 26 | On Automatic creation |
| 27 | Uses |
| 28 | Creative techniques |
| 29 | Strategic planning |
| 30 | Argument mapping |
| 31 | Tools |
| 32 | Pen and paper |
| 33 | Mermaid |
| 34 | `); |
| 35 | }, 2500); |
| 36 | }; |
| 37 | |
| 38 | window.addEventListener('load', () => void load(), false); |
| 39 | |