Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
HasTorchlightIntegration | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
4 | |
100.00% |
1 / 1 |
determineIfTorchlightAttributionShouldBeInjected | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
3 | |||
injectTorchlightAttribution | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace Hyde\Framework\Concerns\Markdown; |
4 | |
5 | /** |
6 | * Helper methods for the Torchlight integration. |
7 | * |
8 | * @see \Hyde\Framework\Services\MarkdownConverterService |
9 | */ |
10 | trait HasTorchlightIntegration |
11 | { |
12 | protected bool $useTorchlight; |
13 | protected bool $torchlightAttribution; |
14 | |
15 | protected function determineIfTorchlightAttributionShouldBeInjected(): bool |
16 | { |
17 | return ! $this->isDocumentationPage() |
18 | && config('torchlight.attribution.enabled', true) |
19 | && str_contains($this->html, 'Syntax highlighted by torchlight.dev'); |
20 | } |
21 | |
22 | protected function injectTorchlightAttribution(): string |
23 | { |
24 | return '<br>'.$this->converter->convert(config( |
25 | 'torchlight.attribution.markdown', |
26 | 'Syntax highlighted by torchlight.dev' |
27 | )); |
28 | } |
29 | } |