diff --git a/packages/framework/src/Framework/Actions/GeneratesTableOfContents.php b/packages/framework/src/Framework/Actions/GeneratesTableOfContents.php index 939e6acb552..5ed8e632c18 100644 --- a/packages/framework/src/Framework/Actions/GeneratesTableOfContents.php +++ b/packages/framework/src/Framework/Actions/GeneratesTableOfContents.php @@ -7,9 +7,6 @@ use Hyde\Facades\Config; use Hyde\Markdown\Models\Markdown; use Illuminate\Support\Str; -use League\CommonMark\Environment\Environment; -use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; -use League\CommonMark\Extension\HeadingPermalink\HeadingPermalinkExtension; class GeneratesTableOfContents { diff --git a/packages/framework/tests/Unit/GeneratesSidebarTableOfContentsTest.php b/packages/framework/tests/Unit/GeneratesSidebarTableOfContentsTest.php index 075086d6339..84728301ade 100644 --- a/packages/framework/tests/Unit/GeneratesSidebarTableOfContentsTest.php +++ b/packages/framework/tests/Unit/GeneratesSidebarTableOfContentsTest.php @@ -22,7 +22,7 @@ public function testCanGenerateTableOfContents() { $markdown = "# Level 1\n## Level 2\n## Level 2B\n### Level 3\n"; $result = (new GeneratesTableOfContents($markdown))->execute(); - + $this->assertSame([ [ 'title' => 'Level 2', @@ -50,9 +50,9 @@ public function testReturnStringContainsExpectedContent() ## Level 2 ### Level 3 MARKDOWN; - + $result = (new GeneratesTableOfContents($markdown))->execute(); - + $this->assertSame([ [ 'title' => 'Level 2', @@ -153,9 +153,9 @@ public function testWithNoLevelOneHeading() ## Level 2 ### Level 3 MARKDOWN; - + $result = (new GeneratesTableOfContents($markdown))->execute(); - + $this->assertSame([ [ 'title' => 'Level 2', @@ -187,9 +187,9 @@ public function testWithMultipleNestedHeadings() ## Level 2C ### Level 3D MARKDOWN; - + $result = (new GeneratesTableOfContents($markdown))->execute(); - + $this->assertSame([ [ 'title' => 'Level 2', @@ -248,9 +248,9 @@ public function testWithMultipleLevelOneHeadings() ## Level 2B ### Level 3B MARKDOWN; - + $result = (new GeneratesTableOfContents($markdown))->execute(); - + $this->assertSame([ [ 'title' => 'Level 2', @@ -299,9 +299,9 @@ public function testRespectsMinHeadingLevelConfig() ### Level 3 #### Level 4 MARKDOWN; - + $result = (new GeneratesTableOfContents($markdown))->execute(); - + $this->assertSame([ [ 'title' => 'Level 3', @@ -329,9 +329,9 @@ public function testRespectsMaxHeadingLevelConfig() ### Level 3 #### Level 4 MARKDOWN; - + $result = (new GeneratesTableOfContents($markdown))->execute(); - + $this->assertSame([ [ 'title' => 'Level 2', @@ -355,9 +355,9 @@ public function testRespectsMinAndMaxHeadingLevelConfig() #### Level 4 ##### Level 5 MARKDOWN; - + $result = (new GeneratesTableOfContents($markdown))->execute(); - + $this->assertSame([ [ 'title' => 'Level 2', @@ -437,7 +437,7 @@ public function testHandlesInvalidConfigLevels() 'docs.sidebar.table_of_contents.min_heading_level' => -1, 'docs.sidebar.table_of_contents.max_heading_level' => -2, ]); - + $markdown = "## Level 2\n### Level 3"; $this->assertSame([], (new GeneratesTableOfContents($markdown))->execute()); @@ -446,7 +446,7 @@ public function testHandlesInvalidConfigLevels() 'docs.sidebar.table_of_contents.min_heading_level' => 7, 'docs.sidebar.table_of_contents.max_heading_level' => 8, ]); - + $this->assertSame([], (new GeneratesTableOfContents($markdown))->execute()); // Test swapped levels (min > max) @@ -454,7 +454,7 @@ public function testHandlesInvalidConfigLevels() 'docs.sidebar.table_of_contents.min_heading_level' => 4, 'docs.sidebar.table_of_contents.max_heading_level' => 2, ]); - + $this->assertSame([], (new GeneratesTableOfContents($markdown))->execute()); } @@ -477,15 +477,15 @@ public function testSetextHeadersWithDifferentConfigLevels() $this->assertSame([ [ - "title" => "Level 1", - "slug" => "level-1", - "children" => [ + 'title' => 'Level 1', + 'slug' => 'level-1', + 'children' => [ [ - "title" => "Level 2", - "slug" => "level-2", - "children" => [], - ] - ] + 'title' => 'Level 2', + 'slug' => 'level-2', + 'children' => [], + ], + ], ], ], $result);