Torchlight

Blade 에서 적용방법
<x-torchlight-code language='php'>
    echo "Hello World!";
</x-torchlight-code>

설치하기

composer 를 이용해서 파일을 다운로드 한다.
1composer require torchlight/torchlight-laravel

Middleware

RenderTorchligth::class 를 추가해 준다.
1protected $middleware = [
2 \Torchlight\Middleware\RenderTorchlight::class,
3 \App\Http\Middleware\TrustProxies::class,
4 \Fruitcake\Cors\HandleCors::class,
5 \App\Http\Middleware\PreventRequestsDuringMaintenance::class,
6 \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
7 \App\Http\Middleware\TrimStrings::class,
8 \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
9];

Configuration

1php artisan torchlight:install

config/torchlight.php

1 
2return [
3 // The Torchlight client caches highlighted code blocks. Here
4 // you can define which cache driver you'd like to use.
5 'cache' => env('TORCHLIGHT_CACHE_DRIVER'),
6 
7 // Which theme you want to use. You can find all of the themes at
8 // https://torchlight.dev/themes.
9 'theme' => env('TORCHLIGHT_THEME', 'material-theme-palenight'),
10 
11 // Your API token from torchlight.dev.
12 'token' => env('TORCHLIGHT_TOKEN'),
13 
14 // If you want to register the blade directives, set this to true.
15 'blade_components' => true,
16 
17 // The Host of the API.
18 'host' => env('TORCHLIGHT_HOST', 'https://api.torchlight.dev'),
19 
20 // Global options to control blocks-level settings.
21 // @see https://torchlight.dev/docs/options
22 'options' => [
23 // Turn line numbers on or off globally
24 'lineNumbers' => true,
25 
26 // Control the `style` attribute applied to line numbers.
27 // 'lineNumbersStyle' => '',
28 
29 // Turn on +/- diff indicators.
30 'diffIndicators' => true,
31 
32 // If there are any diff indicators for a line, put them
33 // in place of the line number to save horizontal space.
34 'diffIndicatorsInPlaceOfLineNumbers' => true,
35 
36 // When lines are collapsed, this is the text that will
37 // be shown to indicate that they can be expanded.
38 // 'summaryCollapsedIndicator' => '...',
39 ]
40];