@php // Built here rather than inline: markdown mail is whitespace-sensitive // and inline @if blocks inside list items break the Blade parse. $paragraphs = collect(preg_split('/\R{2,}/', trim((string) $body))) ->map(fn ($p) => trim($p)) ->filter() ->all(); $quoteLines = collect($quotes ?? []) ->map(function ($q) { $text = is_array($q) ? ($q['quote'] ?? $q['text'] ?? '') : $q; if (! trim((string) $text)) { return null; } $who = is_array($q) ? trim(($q['name'] ?? '') . (($q['role'] ?? '') ? ', ' . $q['role'] : '')) : ''; return ['text' => trim($text), 'who' => $who]; }) ->filter() ->values(); @endphp # {{ $headline }} Hello {{ $recipientName }}, {{ $agencyName }} is sharing the release below. You are welcome to use it in full or in part. --- @foreach($paragraphs as $paragraph) {{ $paragraph }} @endforeach @if($quoteLines->isNotEmpty()) --- **Quotes for attribution** @foreach($quoteLines as $q) > {{ $q['text'] }} @if($q['who']) > > — {{ $q['who'] }} @endif @endforeach @endif @if($assets->isNotEmpty()) --- **Press kit — {{ $assets->count() }} {{ \Illuminate\Support\Str::plural('file', $assets->count()) }} for your use** @foreach($assets as $asset) @php $note = collect([ $asset->kindLabel(), $asset->caption ?: null, $asset->credit ? 'Credit: ' . $asset->credit : null, ])->filter()->join(' · '); @endphp - [{{ $asset->file_name }}]({{ $asset->file_url }}) — {{ $note }} @endforeach These are cleared for editorial use with the credit shown. @endif --- Reply to this email if you need anything further — an interview, higher-resolution images, or additional background. Regards, {{ $agencyName }}