From 4200ea118c82394b44021e1bbd5ed5f941afee56 Mon Sep 17 00:00:00 2001 From: nanhaoluo <3075912108@qq.com> Date: Sat, 24 Jan 2026 21:57:23 +0800 Subject: [PATCH] =?UTF-8?q?debug:=20=E6=B7=BB=E5=8A=A0=E8=AF=A6=E7=BB=86?= =?UTF-8?q?=E7=9A=84=E4=BB=A3=E7=A0=81=E6=8F=90=E5=8F=96=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 convertMermaidCodeblocks 中添加代码长度和内容日志 - 在 extractMermaidCode 中添加详细的提取信息 - 输出元素 HTML 以便排查问题 --- argontheme.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/argontheme.js b/argontheme.js index 78a7b72..c17e677 100644 --- a/argontheme.js +++ b/argontheme.js @@ -4005,6 +4005,13 @@ function convertMermaidCodeblocks(){ container.textContent = code; container.dataset.processed = 'true'; + // 调试日志 + if (typeof console !== 'undefined' && console.log) { + console.log('[Mermaid 转换] 代码长度:', code.length); + console.log('[Mermaid 转换] 代码内容:', code.substring(0, 200)); + console.log('[Mermaid 转换] 容器 textContent:', container.textContent.substring(0, 200)); + } + // 替换元素 const targetElement = element.closest('pre') || element; if (targetElement.parentNode) { @@ -4781,17 +4788,21 @@ void 0; // 处理 Shortcode 格式(推荐) if (element.classList.contains('mermaid-shortcode')) { code = element.textContent; - this.logDebug('从 Shortcode 格式提取代码'); + this.logDebug('从 Shortcode 格式提取代码,长度: ' + code.length); + this.logDebug('代码内容: ' + code.substring(0, 200)); } // 处理代码块魔改格式(新增) else if (element.classList.contains('mermaid-from-codeblock')) { code = element.textContent; - this.logDebug('从代码块魔改格式提取代码'); + this.logDebug('从代码块魔改格式提取代码,长度: ' + code.length); + this.logDebug('代码内容: ' + code.substring(0, 200)); + this.logDebug('元素 HTML: ' + element.outerHTML.substring(0, 300)); } // 处理 Markdown 容器语法格式 else if (element.classList.contains('mermaid-container-block')) { code = element.textContent; - this.logDebug('从 Markdown 容器语法提取代码'); + this.logDebug('从 Markdown 容器语法提取代码,长度: ' + code.length); + this.logDebug('代码内容: ' + code.substring(0, 200)); } // 根据不同的元素类型提取代码 else if (element.tagName === 'DIV' && element.classList.contains('mermaid')) {