@php $converter = new \League\CommonMark\GithubFlavoredMarkdownConverter([ 'html_input' => 'escape', 'allow_unsafe_links' => false, ]); // 把 emoji 狀態轉成 HTML badge(PDF 沒有 JS) function convertBadges($html) { $html = preg_replace('/✅\s*(通過|符合|已設定|完整|正確|安全)/', '✅ $1', $html); $html = preg_replace('/⚠️\s*(部分符合|無法判定|部分|需注意)/', '⚠️ $1', $html); $html = preg_replace('/❌\s*(未實作|不符合|未實現|缺失|危險)/', '❌ $1', $html); $html = preg_replace('/🔴\s*高/', '🔴 高', $html); $html = preg_replace('/🟡\s*中/', '🟡 中', $html); $html = preg_replace('/🟢\s*低/', '🟢 低', $html); return $html; } @endphp {{-- 封面 --}}

程式碼檢查報告

{{ $report->title }}

專案:{{ $report->project->name }} | 客戶:{{ $report->client?->name ?? '未分類' }} | 報告日期:{{ now()->format('Y-m-d H:i') }} | 建立者:{{ $report->user->name }}
{{-- Part 1: 掃描結果 --}} @if ($report->code_scan_result)

Part 1:程式碼功能掃描

{!! convertBadges($converter->convert($report->code_scan_result)) !!}
@endif {{-- Part 2: 規格比對 --}} @if ($report->ai_code_review)

Part 2:規格比對檢查

{!! convertBadges($converter->convert($report->ai_code_review)) !!}
@endif