Skip to content

Commit

Permalink
Merge pull request #1803 from hydephp/fix-heading-permalinks-button-t…
Browse files Browse the repository at this point in the history
…ext-showing-in-google-search-previews

Improve the documentation heading permalinks hydephp/develop@d626904
  • Loading branch information
github-actions authored and caendesilva committed Jul 8, 2024
1 parent 01f88ac commit 3ab1344
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Framework/Services/AssetService.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
class AssetService
{
/** @var string The default HydeFront SemVer tag to load. This constant is set to match the styles used for the installed framework version. */
final public const HYDEFRONT_VERSION = 'v3.3';
final public const HYDEFRONT_VERSION = 'v3.4';

/** @var string The default HydeFront CDN path pattern. The Blade-style placeholders are replaced with the proper values. */
final public const HYDEFRONT_CDN_URL = 'https://cdn.jsdelivr.net/npm/hydefront@{{ $version }}/dist/{{ $file }}';
Expand Down
3 changes: 2 additions & 1 deletion src/Framework/Services/MarkdownService.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,10 @@ protected function configurePermalinksExtension(): void
'heading_permalink' => [
'id_prefix' => '',
'fragment_prefix' => '',
'symbol' => '#',
'symbol' => '',
'insert' => 'after',
'min_heading_level' => 2,
'aria_hidden' => false,
],
], $this->config);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/MarkdownServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public function testServiceCanParseMarkdownToHtmlWithPermalinks()

$this->assertIsString($html);
$this->assertSame(
'<h2>Hello World!<a id="hello-world" href="#hello-world" class="heading-permalink" aria-hidden="true" '.
'title="Permalink">#</a></h2>'."\n",
'<h2>Hello World!<a id="hello-world" href="#hello-world" class="heading-permalink" '.
'title="Permalink"></a></h2>'."\n",
$html
);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/StaticSiteBuilderDocumentationModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testPageContainsExpectedContent()
{
$this->inspectHtml([
'Adventures in Wonderland',
'<h2>CHAPTER I. DOWN THE RABBIT-HOLE.<a id="chapter-i-down-the-rabbit-hole" href="#chapter-i-down-the-rabbit-hole" class="heading-permalink" aria-hidden="true" title="Permalink">#</a></h2>',
'<h2>CHAPTER I. DOWN THE RABBIT-HOLE.<a id="chapter-i-down-the-rabbit-hole" href="#chapter-i-down-the-rabbit-hole" class="heading-permalink" title="Permalink"></a></h2>',
'<p>So she was considering in her own mind, as well as she could',
]);
}
Expand All @@ -55,7 +55,7 @@ public function testCanCompilePageToRootOutputDirectory()

$this->inspectHtml([
'Adventures in Wonderland',
'<h2>CHAPTER I. DOWN THE RABBIT-HOLE.<a id="chapter-i-down-the-rabbit-hole" href="#chapter-i-down-the-rabbit-hole" class="heading-permalink" aria-hidden="true" title="Permalink">#</a></h2>',
'<h2>CHAPTER I. DOWN THE RABBIT-HOLE.<a id="chapter-i-down-the-rabbit-hole" href="#chapter-i-down-the-rabbit-hole" class="heading-permalink" title="Permalink"></a></h2>',
'<p>So she was considering in her own mind, as well as she could',
], '_site/test-page.html');
}
Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/AssetServiceUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected function setUp(): void

public function testVersionStringConstant()
{
$this->assertSame('v3.3', AssetService::HYDEFRONT_VERSION);
$this->assertSame('v3.4', AssetService::HYDEFRONT_VERSION);
}

public function testServiceHasVersionString()
Expand Down Expand Up @@ -56,7 +56,7 @@ public function testCanSetCustomCdnUrlInConfig()
public function testCanUseCustomCdnUrlWithVersion()
{
self::mockConfig(['hyde.hydefront_url' => '{{ $version }}']);
$this->assertSame('v3.3', (new AssetService())->cdnLink(''));
$this->assertSame('v3.4', (new AssetService())->cdnLink(''));
}

public function testCanUseCustomCdnUrlWithFile()
Expand All @@ -68,7 +68,7 @@ public function testCanUseCustomCdnUrlWithFile()
public function testCanUseCustomCdnUrlWithVersionAndFile()
{
self::mockConfig(['hyde.hydefront_url' => '{{ $version }}/{{ $file }}']);
$this->assertSame('v3.3/styles.css', (new AssetService())->cdnLink('styles.css'));
$this->assertSame('v3.4/styles.css', (new AssetService())->cdnLink('styles.css'));
}

public function testCanUseCustomCdnUrlWithCustomVersion()
Expand All @@ -83,7 +83,7 @@ public function testCanUseCustomCdnUrlWithCustomVersion()
public function testCdnLinkHelper()
{
$this->assertSame(
'https://cdn.jsdelivr.net/npm/hydefront@v3.3/dist/styles.css',
'https://cdn.jsdelivr.net/npm/hydefront@v3.4/dist/styles.css',
(new AssetService())->cdnLink('styles.css')
);
}
Expand Down

0 comments on commit 3ab1344

Please sign in to comment.