debug: add detailed logging for WP-Markdown format

This commit is contained in:
2026-01-23 21:29:46 +08:00
parent a5a8225ff2
commit d11336dd35

View File

@@ -211,15 +211,31 @@
let scriptContent = scriptElement.textContent;
console.log('=== WP-Markdown Debug ===');
console.log('Script content (first 300 chars):', scriptContent.substring(0, 300));
let match = scriptContent.match(/document\.write\("(.*)"\)/s);
if (match && match[1]) {
let rawCode = match[1];
console.log('Raw code (first 300 chars):', rawCode.substring(0, 300));
console.log('Contains literal backslash-n:', rawCode.includes('\\n'));
console.log('Contains actual newline:', rawCode.includes('\n'));
// 解码转义字符
let code = match[1]
let code = rawCode
.replace(/\\n/g, '\n')
@@ -235,6 +251,12 @@
console.log('After decode (first 300 chars):', code.substring(0, 300));
console.log('After decode contains newline:', code.includes('\n'));
console.log('WP-Markdown Mermaid code found (length: ' + code.length + ')');
console.log('Contains newlines:', code.indexOf('\n') !== -1);