From 2ebbf5cb97acd26d7ba91b2ea7fc73d1daa47fc4 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Sat, 3 Feb 2024 19:53:57 -0500 Subject: [PATCH] Move away from Anchor.js "header" term to use "heading" --- CHANGELOG.md | 8 ++++---- assets/scss/_content.scss | 4 ++-- layouts/_default/_markup/_heading-link.html | 1 + layouts/_default/_markup/render-heading.html | 8 ++------ 4 files changed, 9 insertions(+), 12 deletions(-) create mode 100644 layouts/_default/_markup/_heading-link.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 9641dd3ee..49ed52c8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,14 +38,14 @@ For the full list of changes, see the [0.9.0] release notes. [path_base_for_github_subdir]. Projects will need to adjust the value of [path_base_for_github_subdir] to be relative to the file's physical location. -- Docsy statically generates anchor-links after headings using Hugo's +- Docsy statically generates anchor links after headings using Hugo's [render-heading.html](https://gohugo.io/templates/render-hooks/) hook. This is _potentially_ a breaking change for projects that override the hook. The default heading-link symbol is `#`, but it can be customized via the - `.td-header-link` class. Projects can also _reuse_ (in their own heading - render hooks) or _override_ the heading anchor-link template - `docsy/header-link.html` under `layouts`. + `.td-heading-link` class. Projects can also _reuse_ (in their own heading + render hooks) or _override_ the heading-link template + `_default/_markup/_heading-link.html` under `layouts`. - The footer layout has been factored into parts: left, right, and center, with copyright a subpart of center. Each part has its own style tag, for example: diff --git a/assets/scss/_content.scss b/assets/scss/_content.scss index ff257cba0..1c950855d 100644 --- a/assets/scss/_content.scss +++ b/assets/scss/_content.scss @@ -95,7 +95,7 @@ } } -.td-header-link { +.td-heading-link { &:before { content: '#'; } @@ -114,7 +114,7 @@ } @for $i from 1 through 6 { - h#{$i}:hover > .td-header-link { + h#{$i}:hover > .td-heading-link { visibility: visible; } } diff --git a/layouts/_default/_markup/_heading-link.html b/layouts/_default/_markup/_heading-link.html new file mode 100644 index 000000000..494c1ab2b --- /dev/null +++ b/layouts/_default/_markup/_heading-link.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html index ab57be20b..087545d91 100644 --- a/layouts/_default/_markup/render-heading.html +++ b/layouts/_default/_markup/render-heading.html @@ -1,8 +1,4 @@ {{- .Text | safeHTML -}} - {{ template "docsy/header-link.html" . -}} - - -{{- define "docsy/header-link.html" -}} - -{{- end -}} + {{ template "_default/_markup/_heading-link.html" . -}} + \ No newline at end of file