aboutsummaryrefslogtreecommitdiff
path: root/resources/views/components
diff options
context:
space:
mode:
authorFrankie B <git@diskfloppy.me>2023-07-28 23:45:33 +0100
committerFrankie B <frankieraybrown@gmail.com>2023-07-29 18:10:50 +0100
commitf82de3956b104d93461517216fc751fdf09f834f (patch)
treeae09024ce0c96ec92589993d78e43e5c9841fedc /resources/views/components
parent9a10c8db3ade25b1f9e920d0860063b95bd00dd6 (diff)
Add hlphp & codeblock component
Diffstat (limited to 'resources/views/components')
-rw-r--r--resources/views/components/codeblock.blade.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/resources/views/components/codeblock.blade.php b/resources/views/components/codeblock.blade.php
new file mode 100644
index 0000000..8dcebda
--- /dev/null
+++ b/resources/views/components/codeblock.blade.php
@@ -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>