-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It was a change I did not notice when upgrading Docsy from 0.8.0 to 0.11.0. Docsy changed the way heading self links are generated: they used to be rendered with JS and now they use a Hugo render hook. This means two things: - We need to enable them explicitly by overriding the `_default/_markup/render-heading.html` template. - We need to add the self heading ourselves to headings that are not rendered by Hugo, i.e. HTML headings that we create ourselves. Signed-off-by: Kévin Commaille <[email protected]>
- Loading branch information
Showing
6 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Upgrade docsy to 0.11.0 and hugo to 0.138.0. | ||
Upgrade docsy to 0.11.0 and hugo to 0.139.0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Upgrade docsy to 0.11.0 and hugo to 0.139.0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{{- /* | ||
|
||
This is a heading render hook (https://gohugo.io/render-hooks/headings/) | ||
using Docsy's heading self-links hook (https://www.docsy.dev/docs/adding-content/navigation/#heading-self-links). | ||
|
||
This is used when a heading is encountered in markdown content to generate | ||
the HTML for that heading. A self-link anchor is added at the end of the | ||
heading. | ||
|
||
*/ -}} | ||
{{ template "_default/_markup/td-render-heading.html" . }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{{- /* | ||
|
||
A simplified copy of the inlined "_default/_markup/_td-heading-self-link.html" | ||
template in Docsy's "_default/_markup/td-render-heading.html" template to be | ||
able to reuse it when the heading has custom markup. | ||
|
||
Takes a string which is the ID of the heading. | ||
|
||
*/ -}} | ||
|
||
<a class="td-heading-self-link" href="#{{ . | safeURL }}" aria-label="Heading self-link"></a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters