Skip to content

Commit

Permalink
Move away from Anchor.js "header" term to use "heading"
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin committed Feb 4, 2024
1 parent b94a36b commit 2ebbf5c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions assets/scss/_content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
}
}

.td-header-link {
.td-heading-link {
&:before {
content: '#';
}
Expand All @@ -114,7 +114,7 @@
}

@for $i from 1 through 6 {
h#{$i}:hover > .td-header-link {
h#{$i}:hover > .td-heading-link {
visibility: visible;
}
}
1 change: 1 addition & 0 deletions layouts/_default/_markup/_heading-link.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a class="td-heading-link" href="#{{ .Anchor | safeURL }}"></a>
8 changes: 2 additions & 6 deletions layouts/_default/_markup/render-heading.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<h{{ .Level }} id="{{- .Anchor | safeURL -}}">
{{- .Text | safeHTML -}}
{{ template "docsy/header-link.html" . -}}
</h{{ .Level }}>

{{- define "docsy/header-link.html" -}}
<a class="td-header-link" href="#{{ .Anchor | safeURL }}"></a>
{{- end -}}
{{ template "_default/_markup/_heading-link.html" . -}}
</h{{ .Level }}>

0 comments on commit 2ebbf5c

Please sign in to comment.