mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-15 21:39:40 +02:00
Fix double rendering in docsify
This commit is contained in:
@@ -100,24 +100,12 @@
|
||||
markdown: {
|
||||
renderer: {
|
||||
code: function (code, lang) {
|
||||
if (lang && (lang.startsWith('mermaid') || lang === 'mmd')) {
|
||||
var resultingHTML = '';
|
||||
|
||||
if (lang === 'mmd' || lang === 'mermaid-example') {
|
||||
currentCodeExample++;
|
||||
colorize.push(currentCodeExample);
|
||||
resultingHTML +=
|
||||
'<pre id="code' + currentCodeExample + '">' + escapeHTML(code) + '</pre>';
|
||||
}
|
||||
|
||||
if (lang === 'mermaid' || lang === 'mermaid-example') {
|
||||
resultingHTML +=
|
||||
'<div class="mermaid">' + mermaid.render('mermaid-svg-' + num++, code) + '</div>';
|
||||
}
|
||||
|
||||
if (resultingHTML !== '') {
|
||||
return resultingHTML;
|
||||
}
|
||||
if (lang === 'mermaid-example') {
|
||||
currentCodeExample++;
|
||||
colorize.push(currentCodeExample);
|
||||
return '<pre id="code' + currentCodeExample + '">' + escapeHTML(code) + '</pre>';
|
||||
} else if (lang === 'mermaid') {
|
||||
return '<div class="mermaid">' + mermaid.render('mermaid-svg-' + num++, code) + '</div>';
|
||||
}
|
||||
return this.origin.code.apply(this, arguments);
|
||||
},
|
||||
|
Reference in New Issue
Block a user