From f82de3956b104d93461517216fc751fdf09f834f Mon Sep 17 00:00:00 2001 From: Frankie B Date: Fri, 28 Jul 2023 23:45:33 +0100 Subject: Add hlphp & codeblock component --- resources/views/components/codeblock.blade.php | 14 ++++++++++++++ resources/views/includes/head-hljs.blade.php | 15 +++++++++++++++ resources/views/layouts/default-hljs.blade.php | 23 +++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 resources/views/components/codeblock.blade.php create mode 100644 resources/views/includes/head-hljs.blade.php create mode 100644 resources/views/layouts/default-hljs.blade.php (limited to 'resources') 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 +
+    

{{ $file_name }} {{ $file_size}} bytes

+
+ {!! $highlighted->value !!} +
diff --git a/resources/views/includes/head-hljs.blade.php b/resources/views/includes/head-hljs.blade.php new file mode 100644 index 0000000..5011b6e --- /dev/null +++ b/resources/views/includes/head-hljs.blade.php @@ -0,0 +1,15 @@ + + + + + + + + + + + + ~floppydisk / @yield('title') + + + diff --git a/resources/views/layouts/default-hljs.blade.php b/resources/views/layouts/default-hljs.blade.php new file mode 100644 index 0000000..a9380b0 --- /dev/null +++ b/resources/views/layouts/default-hljs.blade.php @@ -0,0 +1,23 @@ + + + + @include('includes.head-hljs') + + + +
+
+ @include('includes.header') +
+ +
+
+@yield('content') +
+ +
+
+ + -- cgit v1.2.3-54-g00ecf