aboutsummaryrefslogtreecommitdiff
path: root/resources/views/components/codeblock.blade.php
blob: 3d3594f80a2e352ca603b7dd2ade6451faf26301 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@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="codeblock">
    <h1>{{ $file_name }} <small>{{ $file_size}} bytes</small></h1>
    <hr>
    <code class="hljs {{$highlighted->language}}">{!! $highlighted->value !!}</code>
</div>