fix: use async in render-after-error

This commit is contained in:
Sidharth Vinod
2022-10-06 17:49:10 +08:00
parent 646a96e5f0
commit d59f878020

View File

@@ -14,15 +14,16 @@
mermaid.init({ startOnLoad: false }); mermaid.init({ startOnLoad: false });
mermaid.mermaidAPI.initialize({ securityLevel: 'strict' }); mermaid.mermaidAPI.initialize({ securityLevel: 'strict' });
(async () => {
try {
console.log('rendering');
await mermaid.mermaidAPI.render('graphDiv', `>`);
} catch (e) {}
try { await mermaid.mermaidAPI.render('graphDiv', `graph LR\n a --> b`, (html) => {
console.log('rendering'); document.getElementById('graph').innerHTML = html;
mermaid.mermaidAPI.render('graphDiv', `>`); });
} catch (e) {} })();
mermaid.mermaidAPI.render('graphDiv', `graph LR\n a --> b`, (html) => {
document.getElementById('graph').innerHTML = html;
});
</script> </script>
</body> </body>
</html> </html>