Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| HasTableOfContents | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
| constructTableOfContents | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Hyde\Framework\Concerns; |
| 4 | |
| 5 | use Hyde\Framework\Actions\GeneratesTableOfContents; |
| 6 | |
| 7 | /** |
| 8 | * Generate Table of Contents as HTML from a Markdown document body. |
| 9 | * |
| 10 | * @see \Tests\Unit\HasTableOfContentsTest |
| 11 | */ |
| 12 | trait HasTableOfContents |
| 13 | { |
| 14 | public string $tableOfContents; |
| 15 | |
| 16 | public function constructTableOfContents(): void |
| 17 | { |
| 18 | if (config('docs.table_of_contents.enabled', true)) { |
| 19 | $this->tableOfContents = (new GeneratesTableOfContents($this->body))->execute(); |
| 20 | } |
| 21 | } |
| 22 | } |