diff --git a/tests/test-codeblock-magic.html b/tests/test-codeblock-magic.html index aeb7cdf..5aac4af 100644 --- a/tests/test-codeblock-magic.html +++ b/tests/test-codeblock-magic.html @@ -269,15 +269,17 @@ classDiagram const code = block.textContent; try { - mermaid.render(id, code).then(result => { + // Mermaid 10.x 使用 render 方法,返回 Promise + mermaid.render(id, code).then(function(result) { block.innerHTML = result.svg; console.log('[Mermaid] 成功渲染图表 ' + (index + 1)); - }).catch(error => { + }).catch(function(error) { console.error('[Mermaid] 渲染失败:', error); block.innerHTML = '
渲染失败: ' + error.message + '
'; }); } catch (error) { console.error('[Mermaid] 渲染异常:', error); + block.innerHTML = '
渲染异常: ' + error.message + '
'; } }); }