FEATURE: Add anchor links to headings (#12379)

This commit is contained in:
Bianca Nenciu
2021-03-23 10:45:06 +02:00
committed by GitHub
parent e48d055232
commit 2ad9b3f432
7 changed files with 66 additions and 8 deletions

View File

@@ -189,8 +189,8 @@ describe PrettyText do
</div>
HTML
expect(cooked).to include("<h1>Pre-heading</h1>")
expect(cooked).to include("<h1>Post-heading</h1>")
expect(cooked).to include("<h1>\n<a name=\"pre-heading\" class=\"anchor\" href=\"#pre-heading\"></a>Pre-heading</h1>")
expect(cooked).to include("<h1>\n<a name=\"post-heading\" class=\"anchor\" href=\"#post-heading\"></a>Post-heading</h1>")
end
it "does not break when there are headings before/after a poll without a title" do
@@ -211,7 +211,7 @@ describe PrettyText do
<div class="poll" data-poll-status="open" data-poll-name="poll">
HTML
expect(cooked).to include("<h1>Pre-heading</h1>")
expect(cooked).to include("<h1>Post-heading</h1>")
expect(cooked).to include("<h1>\n<a name=\"pre-heading\" class=\"anchor\" href=\"#pre-heading\"></a>Pre-heading</h1>")
expect(cooked).to include("<h1>\n<a name=\"post-heading\" class=\"anchor\" href=\"#post-heading\"></a>Post-heading</h1>")
end
end