From c9721c5eb5997b2bbd2422b887bcdd3ff5fb72a7 Mon Sep 17 00:00:00 2001 From: Silberengel Date: Wed, 9 Jul 2025 16:41:14 +0200 Subject: [PATCH] cleaned up debugging --- src/lib/parser.ts | 5 ++--- .../utils/markup/advancedAsciidoctorPostProcessor.ts | 10 +--------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/lib/parser.ts b/src/lib/parser.ts index c908db5..5ec4cdd 100644 --- a/src/lib/parser.ts +++ b/src/lib/parser.ts @@ -1159,7 +1159,7 @@ function ensureAsciiDocHeader(content: string): string { if (lines[i].trim() === '') continue; if (lines[i].trim().startsWith('=')) { headerIndex = i; - console.debug('[Pharos] AsciiDoc document header:', lines[i].trim()); + break; } else { throw new Error('AsciiDoc document is missing a header at the top.'); @@ -1184,8 +1184,7 @@ function ensureAsciiDocHeader(content: string): string { lines.splice(headerIndex + 1, 0, ':doctype: book'); } - // Log the state of the lines before returning - console.debug('[Pharos] AsciiDoc lines after header/doctype normalization:', lines.slice(0, 5)); + return lines.join('\n'); } diff --git a/src/lib/utils/markup/advancedAsciidoctorPostProcessor.ts b/src/lib/utils/markup/advancedAsciidoctorPostProcessor.ts index 33f3a16..36657f9 100644 --- a/src/lib/utils/markup/advancedAsciidoctorPostProcessor.ts +++ b/src/lib/utils/markup/advancedAsciidoctorPostProcessor.ts @@ -43,18 +43,12 @@ function fixAllMathBlocks(html: string): string { // Unescape \$ to $ for math delimiters html = html.replace(/\\\$/g, '$'); - // DEBUG: Log the HTML before MathJax runs - if (html.includes('latexmath')) { - console.debug('Processed HTML for latexmath:', html); - } + // Block math:
...
html = html.replace( /
\s*
([\s\S]*?)<\/div>\s*<\/div>/g, (_match, mathContent) => { - // DEBUG: Log the original and cleaned math content - console.debug('Block math original:', mathContent); - console.debug('Block math char codes:', Array.from(mathContent as string).map((c: string) => c.charCodeAt(0))); let cleanMath = mathContent .replace(/\$<\/span>/g, '') .replace(/\$\$<\/span>/g, '') @@ -64,8 +58,6 @@ function fixAllMathBlocks(html: string): string { // Remove all leading and trailing whitespace and $ .replace(/^[\s$]+/, '').replace(/[\s$]+$/, '') .trim(); // Final trim to remove any stray whitespace or $ - console.debug('Block math cleaned:', cleanMath); - console.debug('Block math cleaned char codes:', Array.from(cleanMath as string).map((c: string) => c.charCodeAt(0))); // Always wrap in $$...$$ return `
$$${cleanMath}$$
`; }