diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 42b678e6888..99512f0f661 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -15,6 +15,7 @@ This serves two purposes: ### Changed - Changed how the documentation search is generated, to be an `InMemoryPage` instead of a post-build task. - Media asset files are now copied using the new build task instead of the deprecated `BuildService::transferMediaAssets()` method. +- Minor: The documentation article component now supports disabling the semantic rendering using a falsy value in https://github.com/hydephp/develop/pull/1566 ### Deprecated - for soon-to-be removed features. diff --git a/packages/framework/resources/views/components/docs/documentation-article.blade.php b/packages/framework/resources/views/components/docs/documentation-article.blade.php index 328f370982d..56c71641771 100644 --- a/packages/framework/resources/views/components/docs/documentation-article.blade.php +++ b/packages/framework/resources/views/components/docs/documentation-article.blade.php @@ -5,16 +5,18 @@
$article->hasTorchlight()])> + 'torchlight-enabled' => $article && $article->hasTorchlight()])> @yield('content') -
- {{ $article->renderHeader() }} -
-
- {{ $article->renderBody() }} -
- + @if ($article) +
+ {{ $article->renderHeader() }} +
+
+ {{ $article->renderBody() }} +
+ + @endif
\ No newline at end of file diff --git a/packages/framework/src/Framework/Features/Documentation/DocumentationSearchPage.php b/packages/framework/src/Framework/Features/Documentation/DocumentationSearchPage.php index 7db4a83ca97..61f4b2e8930 100644 --- a/packages/framework/src/Framework/Features/Documentation/DocumentationSearchPage.php +++ b/packages/framework/src/Framework/Features/Documentation/DocumentationSearchPage.php @@ -39,7 +39,7 @@ public function __construct() parent::__construct(static::routeKey(), [ 'title' => 'Search', 'navigation' => ['hidden' => true], - 'article' => $this->makeArticle(), + 'article' => false, ], view: 'hyde::pages.documentation-search'); } @@ -59,10 +59,4 @@ protected static function anotherSearchPageExists(): bool // we need to check the page collection directly, instead of the route collection. return Hyde::pages()->first(fn (HydePage $file): bool => $file->getRouteKey() === static::routeKey()) !== null; } - - /** @experimental Fixes type issue {@see https://github.com/hydephp/develop/commit/37f7046251b8c0514b8d8ef821de4ef3d35bbac8#commitcomment-135026537} */ - protected function makeArticle(): SemanticDocumentationArticle - { - return SemanticDocumentationArticle::make(new DocumentationPage()); - } } diff --git a/packages/framework/tests/Feature/DocumentationSearchPageTest.php b/packages/framework/tests/Feature/DocumentationSearchPageTest.php index e7a2adc4dc3..2a237064dbc 100644 --- a/packages/framework/tests/Feature/DocumentationSearchPageTest.php +++ b/packages/framework/tests/Feature/DocumentationSearchPageTest.php @@ -76,4 +76,34 @@ public function testStaticRouteKeyHelperWithRootOutputDirectory() DocumentationPage::setOutputDirectory(''); $this->assertSame('search', DocumentationSearchPage::routeKey()); } + + public function testCanRenderSearchPage() + { + $page = new DocumentationSearchPage(); + + Hyde::shareViewData($page); + $this->assertStringContainsString('

Search the documentation site

', $page->compile()); + } + + public function testRenderedSearchPageUsesDocumentationPageLayout() + { + $page = new DocumentationSearchPage(); + + Hyde::shareViewData($page); + $html = $page->compile(); + + $this->assertStringContainsString('compile(); + + $this->assertStringNotContainsString('
assertStringNotContainsString('
assertStringNotContainsString('