diskfloppy.me/resources/views/components/codeblock.blade.php
2023-08-22 20:03:02 +01:00

15 lines
441 B
PHP

@php
$file_path = "code/".$file;
$file_name = basename($file_path);
$hl = new \Highlight\Highlighter();
$highlighted = $hl->highlight($lang, Storage::disk('local')->get($file_path));
$file_size = Storage::disk('local')->size($file_path);
@endphp
<div class="code-block">
<h1>{{ $file_name }} <small>{{ $file_size}} bytes</small></h1>
<hr>
<code class="hljs {{$highlighted->language}}">{!! $highlighted->value !!}</code>
</div>