remove TOC temporary debug error_log calls

This commit is contained in:
Pontoporeia
2026-07-10 15:23:52 +02:00
parent c67262673f
commit 1293b1be6c
6 changed files with 2 additions and 28 deletions
-15
View File
@@ -18,19 +18,6 @@ class MarkdownHelper
$items = [];
$lines = explode("\n", $content);
// ── DEBUG: temporary TOC diagnostics ──────────────────────────
error_log('[TOC-DEBUG] content length: ' . strlen($content));
error_log('[TOC-DEBUG] line count: ' . count($lines));
foreach (array_slice($lines, 0, 8) as $i => $line) {
if ($line === '') {
error_log('[TOC-DEBUG] line[' . $i . '] (empty)');
} else {
$hex = bin2hex($line);
$preview = mb_substr($line, 0, 60);
error_log('[TOC-DEBUG] line[' . $i . '] hex=' . $hex . ' raw=' . $preview);
}
}
// ── END DEBUG ─────────────────────────────────────────────────
// Use CommonMark's own SlugNormalizer so TOC links match the rendered heading IDs exactly.
$normalizer = new \League\CommonMark\Normalizer\SlugNormalizer();
@@ -41,10 +28,8 @@ class MarkdownHelper
$label = trim($m[2]);
$id = $normalizer->normalize($label);
$items[] = ['label' => $label, 'href' => '#' . $id, 'level' => $level];
error_log('[TOC-DEBUG] MATCH: h' . $level . ' "' . $label . '" -> #' . $id);
}
}
error_log('[TOC-DEBUG] total items found: ' . count($items));
return $items;
}
}