Skip to content

Commit

Permalink
Render the heading permalink symbol using a pseudo element
Browse files Browse the repository at this point in the history
This should hopefully fix #1801
  • Loading branch information
caendesilva committed Jul 8, 2024
1 parent 4b63503 commit 8e5407d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ protected function configurePermalinksExtension(): void
'heading_permalink' => [
'id_prefix' => '',
'fragment_prefix' => '',
'symbol' => '#',
'symbol' => '',
'insert' => 'after',
'min_heading_level' => 2,
'aria_hidden' => false,
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/tests/Feature/MarkdownServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function testServiceCanParseMarkdownToHtmlWithPermalinks()
$this->assertIsString($html);
$this->assertSame(
'<h2>Hello World!<a id="hello-world" href="#hello-world" class="heading-permalink" '.
'title="Permalink">#</a></h2>'."\n",
'title="Permalink"></a></h2>'."\n",
$html
);
}
Expand Down
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" 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" 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
3 changes: 3 additions & 0 deletions packages/hydefront/sass/docs/heading-permalinks.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
transition: opacity 0.3s ease;
padding: 0 0.25rem;
scroll-margin: 1rem;
&::before {
content: '#';
}
&:hover, &:focus {
opacity: 1;
filter: unset;
Expand Down

0 comments on commit 8e5407d

Please sign in to comment.