chore(php): add more debug for toc heading detection
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -128,10 +128,21 @@ final class TableOfContentsRenderer implements RendererInterface
|
|||||||
|
|
||||||
error_log("{$debugPrefix}: post_id={$post->ID}, raw_content_length=" . strlen($post->post_content));
|
error_log("{$debugPrefix}: post_id={$post->ID}, raw_content_length=" . strlen($post->post_content));
|
||||||
|
|
||||||
|
// Check if raw content has headings
|
||||||
|
$rawHeadingCount = preg_match_all('/<h[2-6][^>]*>/i', $post->post_content, $rawMatches);
|
||||||
|
error_log("{$debugPrefix}: raw_headings_count={$rawHeadingCount}");
|
||||||
|
|
||||||
$content = apply_filters('the_content', $post->post_content);
|
$content = apply_filters('the_content', $post->post_content);
|
||||||
|
|
||||||
error_log("{$debugPrefix}: filtered_content_length=" . strlen($content));
|
error_log("{$debugPrefix}: filtered_content_length=" . strlen($content));
|
||||||
|
|
||||||
|
// Check if filtered content has headings
|
||||||
|
$filteredHeadingCount = preg_match_all('/<h[2-6][^>]*>/i', $content, $filteredMatches);
|
||||||
|
error_log("{$debugPrefix}: filtered_headings_count={$filteredHeadingCount}");
|
||||||
|
|
||||||
|
// Log first 500 chars of filtered content for diagnosis
|
||||||
|
error_log("{$debugPrefix}: filtered_content_preview=" . substr(strip_tags($content), 0, 300));
|
||||||
|
|
||||||
$dom = new DOMDocument();
|
$dom = new DOMDocument();
|
||||||
libxml_use_internal_errors(true);
|
libxml_use_internal_errors(true);
|
||||||
$dom->loadHTML('<?xml encoding="utf-8" ?>' . $content);
|
$dom->loadHTML('<?xml encoding="utf-8" ?>' . $content);
|
||||||
|
|||||||
Reference in New Issue
Block a user