Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const render = (elt) => {
const svgId = `mermaid-svg-${utils.uid()}`;
const txt = elt.textContent;
containerElt.innerHTML = `<div class="mermaid"><svg id="${svgId}" xmlns="http://www.w3.org/2000/svg"><g></g></svg></div>`;
try {
const graphType = mermaidUtils.detectType(txt);
switch (graphType) {
case 'git':
config.flowchart.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
gitGraphRenderer.setConf(config.git);
gitGraphRenderer.draw(txt, svgId, false);
break;
case 'flowchart':
config.flowchart.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
flowRenderer.setConf(config.flowchart);
flowRenderer.draw(txt, svgId, false);
break;
case 'sequence':
config.sequence.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
sequenceRenderer.setConf(config.sequence);
sequenceRenderer.draw(txt, svgId);
break;
case 'gantt':
config.gantt.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
ganttRenderer.setConf(config.gantt);
ganttRenderer.draw(txt, svgId);
break;
case 'class':
config.class.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
classRenderer.setConf(config.class);
classRenderer.draw(txt, svgId);