Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
elms.forEach((elm) => {
Object.assign(elm.style, {
visibility: 'initial'
});
mermaid.init();
// this.encode(elm);
});
}
initMermaid () {
const {
code,
history,
match: { url }
} = this.props
try {
mermaid.parse(code)
// Replacing special characters '<' and '>' with encoded '<' and '>'
let _code = code
_code = _code.replace(//g, '>')
// Overriding the innerHTML with the updated code string
this.container.innerHTML = _code
mermaid.init(undefined, this.container)
} catch (e) {
// {str, hash}
const base64 = Base64.encodeURI(e.str || e.message)
history.push(`${url}/error/${base64}`)
}
}
renderMermaid () {
const codes = this.exportContainer.querySelectorAll('code.language-mermaid')
for (const code of codes) {
const preEle = code.parentNode
const mermaidContainer = document.createElement('div')
mermaidContainer.innerHTML = code.innerHTML
mermaidContainer.classList.add('mermaid')
preEle.replaceWith(mermaidContainer)
}
// We only export light theme, so set mermaid theme to `default`, in the future, we can choose whick theme to export.
mermaid.initialize({
theme: 'default'
})
mermaid.init(undefined, this.exportContainer.querySelectorAll('div.mermaid'))
if (this.muya) {
mermaid.initialize({
theme: this.muya.options.mermaidTheme
})
}
}
block => mermaid.init(undefined, block)
);
renderMermaid () {
if (this.mermaidCache.size) {
mermaid.initialize({
theme: this.muya.options.mermaidTheme
})
mermaid.init(undefined, document.querySelectorAll(Array.from(this.mermaidCache).join(', ')))
this.mermaidCache.clear()
}
}
}
if (queue.length === 1 && !Array.isArray(queue[0].next)) {
const frame = queue[0];
graphDefinition += `\n${frame.name}`;
}
element.innerHTML = graphDefinition;
document.body.appendChild(element);
mermaid.initialize({
theme: 'default',
rightAngles: false
});
mermaid.init(undefined, element);
}