|
@@ -240,9 +240,15 @@
|
|
|
} else {
|
|
} else {
|
|
|
$label = strtoupper($optIndex);
|
|
$label = strtoupper($optIndex);
|
|
|
}
|
|
}
|
|
|
- // 对LaTeX公式中的特殊字符进行HTML实体编码,防止被浏览器当作HTML标签处理
|
|
|
|
|
- $encodedOpt = htmlspecialchars($opt, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
|
|
|
|
- $renderedOpt = $mathProcessed ? $encodedOpt : \App\Services\MathFormulaProcessor::processFormulas($encodedOpt);
|
|
|
|
|
|
|
+ // 【修复】根据是否已预处理决定处理方式
|
|
|
|
|
+ if ($mathProcessed) {
|
|
|
|
|
+ // 已预处理:数据已包含处理好的 <img> 和公式,直接使用
|
|
|
|
|
+ $renderedOpt = $opt;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 未预处理:先转义保护,processFormulas() 内部会解码并处理
|
|
|
|
|
+ $encodedOpt = htmlspecialchars($opt, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
|
|
|
|
+ $renderedOpt = \App\Services\MathFormulaProcessor::processFormulas($encodedOpt);
|
|
|
|
|
+ }
|
|
|
@endphp
|
|
@endphp
|
|
|
<div class="option option-compact">
|
|
<div class="option option-compact">
|
|
|
<strong>{{ $label }}.</strong> {!! $renderedOpt !!}
|
|
<strong>{{ $label }}.</strong> {!! $renderedOpt !!}
|