fix: torchlight dark mode in script diff

This commit is contained in:
Ahmed Darrazi 2026-01-01 23:00:23 +01:00
parent 72acc8db42
commit 280e2372a9

View File

@ -126,13 +126,13 @@
withWrapper: false,
);
if (! preg_match('/^<pre><code[^>]*>(.*)<\\/code><\\/pre>$/s', $html, $matches)) {
$html = (string) preg_replace('/<!--\s*Syntax highlighted by[^>]*-->/', '', $html);
if (! preg_match('/<code\b[^>]*>.*?<\\/code>/s', $html, $matches)) {
return null;
}
$inner = $matches[1] ?? '';
return trim((string) preg_replace('/<!--\s*Syntax highlighted by[^>]*-->/', '', $inner));
return trim((string) ($matches[0] ?? ''));
} catch (\Throwable $e) {
return null;
}
@ -376,11 +376,16 @@
@endphp
@once
@include('filament.partials.torchlight-dark-overrides')
<style>
.tp-script-diff-line code.torchlight {
background-color: transparent !important;
}
</style>
@endonce
@php
}
echo $leftRendered."\n";
echo '<span class="tp-script-diff-line">'.$leftRendered."</span>\n";
continue;
}
@ -389,11 +394,16 @@
@endphp
@once
@include('filament.partials.torchlight-dark-overrides')
<style>
.tp-script-diff-line code.torchlight {
background-color: transparent !important;
}
</style>
@endonce
@php
}
echo '<span class="block bg-danger-50 text-danger-700 dark:bg-danger-950/40 dark:text-danger-200">- '.$leftRendered."</span>\n";
echo '<span class="block tp-script-diff-line bg-danger-50 text-danger-700 dark:bg-danger-950/40 dark:text-danger-200">- '.$leftRendered."</span>\n";
continue;
}
@ -418,11 +428,16 @@
@endphp
@once
@include('filament.partials.torchlight-dark-overrides')
<style>
.tp-script-diff-line code.torchlight {
background-color: transparent !important;
}
</style>
@endonce
@php
}
echo $rightRendered."\n";
echo '<span class="tp-script-diff-line">'.$rightRendered."</span>\n";
continue;
}
@ -431,11 +446,16 @@
@endphp
@once
@include('filament.partials.torchlight-dark-overrides')
<style>
.tp-script-diff-line code.torchlight {
background-color: transparent !important;
}
</style>
@endonce
@php
}
echo '<span class="block bg-success-50 text-success-700 dark:bg-success-950/40 dark:text-success-200">+ '.$rightRendered."</span>\n";
echo '<span class="block tp-script-diff-line bg-success-50 text-success-700 dark:bg-success-950/40 dark:text-success-200">+ '.$rightRendered."</span>\n";
continue;
}
@ -562,11 +582,16 @@ class="h-full space-y-3"
@endphp
@once
@include('filament.partials.torchlight-dark-overrides')
<style>
.tp-script-diff-line code.torchlight {
background-color: transparent !important;
}
</style>
@endonce
@php
}
echo $leftRendered."\n";
echo '<span class="tp-script-diff-line">'.$leftRendered."</span>\n";
continue;
}
@ -575,11 +600,16 @@ class="h-full space-y-3"
@endphp
@once
@include('filament.partials.torchlight-dark-overrides')
<style>
.tp-script-diff-line code.torchlight {
background-color: transparent !important;
}
</style>
@endonce
@php
}
echo '<span class="block bg-danger-50 text-danger-700 dark:bg-danger-950/40 dark:text-danger-200">- '.$leftRendered."</span>\n";
echo '<span class="block tp-script-diff-line bg-danger-50 text-danger-700 dark:bg-danger-950/40 dark:text-danger-200">- '.$leftRendered."</span>\n";
continue;
}
@ -604,11 +634,16 @@ class="h-full space-y-3"
@endphp
@once
@include('filament.partials.torchlight-dark-overrides')
<style>
.tp-script-diff-line code.torchlight {
background-color: transparent !important;
}
</style>
@endonce
@php
}
echo $rightRendered."\n";
echo '<span class="tp-script-diff-line">'.$rightRendered."</span>\n";
continue;
}
@ -617,11 +652,16 @@ class="h-full space-y-3"
@endphp
@once
@include('filament.partials.torchlight-dark-overrides')
<style>
.tp-script-diff-line code.torchlight {
background-color: transparent !important;
}
</style>
@endonce
@php
}
echo '<span class="block bg-success-50 text-success-700 dark:bg-success-950/40 dark:text-success-200">+ '.$rightRendered."</span>\n";
echo '<span class="block tp-script-diff-line bg-success-50 text-success-700 dark:bg-success-950/40 dark:text-success-200">+ '.$rightRendered."</span>\n";
continue;
}