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> | ||||
							
								
								
									
										15
									
								
								resources/views/includes/head-hljs.blade.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								resources/views/includes/head-hljs.blade.php
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | |||
|     <!-- Global --> | ||||
|     <meta charset="utf-8"> | ||||
|     <meta property="og:type" content="website"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||||
|     <meta name="theme-color" content="#333333"> | ||||
|     <link rel="stylesheet" href="{{ URL::asset ('css/master.css') }}"/> | ||||
|     <link rel="stylesheet" href="{{ URL::asset ('css/highlight.js/tomorrow-night-bright.css') }}"/> | ||||
|     <link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32"/> | ||||
|     <link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16"/> | ||||
| 
 | ||||
|     <!-- Page-specific --> | ||||
|     <title>~floppydisk / @yield('title')</title> | ||||
|     <meta property="og:title" content="~floppydisk / @yield('title')"> | ||||
|     <meta property="og:description" content="@yield('description')"> | ||||
|     <meta property="og:image" content="/favicon.png"> | ||||
							
								
								
									
										23
									
								
								resources/views/layouts/default-hljs.blade.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								resources/views/layouts/default-hljs.blade.php
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | ||||
| <html lang="en"> | ||||
| <head> | ||||
|     @include('includes.head-hljs') | ||||
| </head> | ||||
| 
 | ||||
| <body> | ||||
| <div class="page"> | ||||
| <div class="header"> | ||||
|     @include('includes.header') | ||||
| </div> <!-- header --> | ||||
| 
 | ||||
| <div id="pagebody"> | ||||
|     <div id="content"> | ||||
| @yield('content') | ||||
|     </div> <!-- content --> | ||||
|     <div id="footer" class="pagefooter"> | ||||
|         @include('includes.footer') | ||||
|     </div> <!-- footer --> | ||||
| </div> <!-- pagebody --> | ||||
| </div> <!-- page --> | ||||
| </body> | ||||
| </html> | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Frankie B
				Frankie B