]/i', $block)) { return $block; } return '
' . nl2br($block, false) . '
'; }, $blocks); return implode("\n\n", array_filter($blocks, fn ($b) => $b !== '')); } public static function htmlToMarkdown( ?string $html ): string { if (!$html || trim($html) === '') { return $html; } static $converter = null; if ($converter === null) { $converter = new HtmlConverter(['hard_break' => true]); } return $converter->convert(self::wpAutoP($html)); } }