Skip to content

Commit

Permalink
Use "self-link" terminology
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin committed Feb 7, 2024
1 parent 277298a commit 9a84969
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
13 changes: 7 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ 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 heading self links 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.
_potentially_ a breaking change for projects that override that hook, or make
direct use of `assets/js/anchor.js` (which has been deleted).

The default heading-link symbol is `#`, but it can be customized via the
`.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 default heading self-link symbol is `#`, but it can be customized via the
`.td-heading-self-link` class. Projects can also _reuse_ (in their own heading
render hooks) or _override_ the heading self-link layout
`_default/_markup/_td-heading-self-link.html`.

- 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-heading-link {
.td-heading-self-link {
&:before {
content: '#';
}
Expand All @@ -114,7 +114,7 @@
}

@for $i from 1 through 6 {
h#{$i}:hover > .td-heading-link {
h#{$i}:hover > .td-heading-self-link {
visibility: visible;
}
}
1 change: 0 additions & 1 deletion layouts/_default/_markup/_heading-link.html

This file was deleted.

2 changes: 2 additions & 0 deletions layouts/_default/_markup/_td-heading-self-link.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<a class="td-heading-self-link" href="#{{ .Anchor | safeURL }}" aria-label="Heading self-link"></a>
{{- /* Trim WS */ -}}
5 changes: 3 additions & 2 deletions layouts/_default/_markup/render-heading.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<h{{ .Level }} id="{{- .Anchor | safeURL -}}">
{{- .Text | safeHTML -}}
{{ template "_default/_markup/_heading-link.html" . -}}
</h{{ .Level }}>
{{ template "_default/_markup/_td-heading-self-link.html" . -}}
</h{{ .Level }}>
{{- /* Trim WS */ -}}

0 comments on commit 9a84969

Please sign in to comment.