mermaid = function (...values) {
const div = viewof mermaidContainer;
if (!div) {
throw 'Cannot find div with id "mermaid"';
}
const src = String.raw(...values).trim();
const id = "mmd" + Math.round(Math.random() * 10000);
div.append(html`<div id="${id}" />`);
try {
const result = mermaidJs.render(id, src, undefined);
return svg([result]);
} catch (ex) {
console.error(ex);
throw ex;
}
}