wah.moe/resources/views/components/codeblock.blade.php

15 lines
440 B
PHP
Raw Normal View History

2023-07-28 22:45:33 +00:00
@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
2023-08-14 21:51:16 +00:00
<div class="codeblock">
2023-07-28 22:45:33 +00:00
<h1>{{ $file_name }} <small>{{ $file_size}} bytes</small></h1>
<hr>
<code class="hljs {{$highlighted->language}}">{!! $highlighted->value !!}</code>
2023-08-14 21:51:16 +00:00
</div>