@props(['text']) @php $lines = preg_split("/\r\n|\n|\r/", (string) $text) ?: []; $blocks = []; $currentList = []; $flushList = function () use (&$blocks, &$currentList): void { if ($currentList !== []) { $blocks[] = ['type' => 'list', 'items' => $currentList]; $currentList = []; } }; foreach ($lines as $line) { $trimmed = trim($line); if ($trimmed === '') { $flushList(); continue; } if (preg_match('/^[•\-\x{2013}\*]\s*(.+)$/u', $trimmed, $m)) { $currentList[] = $m[1]; continue; } if (preg_match('/^\d+[\.\)]\s+(.+)$/u', $trimmed, $m)) { $currentList[] = $m[1]; continue; } $flushList(); $blocks[] = ['type' => 'p', 'text' => $trimmed]; } $flushList(); @endphp
{{ $block['text'] }}
@else