Add hlphp & codeblock component
This commit is contained in:
parent
9a5ebd6465
commit
1013cd0456
8 changed files with 338 additions and 1 deletions
14
resources/views/components/codeblock.blade.php
Normal file
14
resources/views/components/codeblock.blade.php
Normal file
|
@ -0,0 +1,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"><pre>
|
||||
<h1>{{ $file_name }} <small>{{ $file_size}} bytes</small></h1>
|
||||
<hr>
|
||||
<code class="hljs {{$highlighted->language}}">{!! $highlighted->value !!}</code>
|
||||
</pre></div>
|
Loading…
Add table
Add a link
Reference in a new issue