|
|
@@ -1258,9 +1258,6 @@ class ExamPdfExportService
|
|
|
*/
|
|
|
private function inlineExternalResources(string $html): string
|
|
|
{
|
|
|
- // 【换行处理】将字面的 \n 转换为 <br> 标签(在 KaTeX 渲染前处理)
|
|
|
- $html = str_replace(['\\n\\n', '\\n'], ['<br><br>', '<br>'], $html);
|
|
|
-
|
|
|
// 【调试】记录HTML内容信息
|
|
|
Log::warning('ExamPdfExportService: inlineExternalResources', [
|
|
|
'html_length' => strlen($html),
|
|
|
@@ -1364,6 +1361,9 @@ class ExamPdfExportService
|
|
|
Log::warning('ExamPdfExportService: KatexRenderer 未初始化,跳过预渲染');
|
|
|
}
|
|
|
|
|
|
+ // 【换行处理】将字面的 \n 转换为 <br> 标签(在 KaTeX 渲染后处理,避免破坏公式)
|
|
|
+ $html = str_replace(['\\n\\n', '\\n'], ['<br><br>', '<br>'], $html);
|
|
|
+
|
|
|
} catch (\Exception $e) {
|
|
|
Log::warning('ExamPdfExportService: 内联资源处理失败,保留原始HTML', [
|
|
|
'error' => $e->getMessage()
|