Skip to content

Commit e423b7d

Browse files
squashed
1 parent 0c396b8 commit e423b7d

3 files changed

Lines changed: 32 additions & 11 deletions

File tree

assets/sass/styles.scss

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,22 +178,26 @@ h1,h2, h3, h4, h5, h6 {
178178
}
179179

180180
/* Base style: zero-width, hidden, no layout shift */
181-
.header-anchor {
181+
.header-anchor {
182182
position: absolute;
183-
left: 0;
184-
padding-right: 0.3em;
185-
margin-left: -1.3em; /* pulls it into the gutter */
183+
top: 50%;
184+
left: -1.9em; /* place the icon farther into the gutter */
185+
transform: translateY(-50%);
186+
padding-right: 0.4em;
186187
width: 0; /* collapsed when not in use */
187188
overflow: hidden; /* hide both icon + any extra */
188189
opacity: 0;
189190
white-space: nowrap; /* keep it on one line */
190-
font-size: 0.7em; /* make the icon smaller */
191+
line-height: 1;
192+
text-decoration: none;
193+
font-size: 0.45em; /* keep the hover icon subtle */
191194
transition:
192195
opacity 0.2s ease-in-out,
193196
width 0.2s ease-in-out;
194197
}
195198

196199
/* On hover (of the heading), expand and show */
200+
h1:hover .header-anchor,
197201
h2:hover .header-anchor,
198202
h3:hover .header-anchor,
199203
h4:hover .header-anchor,

layouts/_default/_markup/render-heading.html renamed to layouts/_markup/render-heading.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{{- /* rendered for each heading */ -}}
2-
{{ $id := .Anchor | default (anchorize .Text) }}
1+
{{- /* Render Markdown headings with the same hover anchor affordance used elsewhere. */ -}}
2+
{{- $id := .Anchor | default (anchorize .Text) -}}
33
<h{{ .Level }} id="{{ $id }}">
44
<a class="header-anchor" href="#{{ $id }}" aria-hidden="true">🔗</a>
55
{{ .Text | safeHTML }}

layouts/partials/hardware-signer/detail.html

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
{{ $summary := or (index $signer.summary $lang) (index $signer.summary "en") }}
66
{{ $discount := $signer.discount }}
77
{{ $slug := or $signer.slug (path.Base (path.Clean $ctx.File.Dir)) }}
8+
{{ $headerID := anchorize $name }}
89
{{ $connections := slice }}
910
{{ if $signer.features.usb }}{{ $connections = $connections | append "USB" }}{{ end }}
1011
{{ if $signer.features.qr }}{{ $connections = $connections | append "QR" }}{{ end }}
@@ -22,7 +23,10 @@
2223
{{ end }}
2324
</div>
2425
<div class="col">
25-
<h1 class="mb-1">{{ $name }}</h1>
26+
<h1 class="mb-1" id="{{ $headerID }}">
27+
<a class="header-anchor" href="#{{ $headerID }}" aria-hidden="true">🔗</a>
28+
{{ $name }}
29+
</h1>
2630
{{ with $summary }}<p class="text-muted mb-2">{{ . }}</p>{{ end }}
2731
<div class="d-flex gap-2 flex-wrap mb-2">
2832
{{ if $signer.bitcoin_only }}<span class="badge bg-warning text-dark">{{ i18n "hardware_badge_bitcoin_only" }}</span>{{ end }}
@@ -48,7 +52,11 @@ <h1 class="mb-1">{{ $name }}</h1>
4852
<div class="content">{{ . }}</div>
4953
{{ else }}
5054
<div class="content">
51-
<h2>{{ i18n "hardware_expect_title" }}</h2>
55+
{{ $expectID := anchorize (i18n "hardware_expect_title") }}
56+
<h2 id="{{ $expectID }}">
57+
<a class="header-anchor" href="#{{ $expectID }}" aria-hidden="true">🔗</a>
58+
{{ i18n "hardware_expect_title" }}
59+
</h2>
5260
<p>{{ i18n "hardware_expect_intro" (dict "Name" $name "Connections" $connectionLabel) }}</p>
5361
<ul>
5462
{{ if $signer.features.usb }}<li>{{ i18n "hardware_expect_usb" }}</li>{{ end }}
@@ -129,12 +137,21 @@ <h2>{{ i18n "hardware_expect_title" }}</h2>
129137
{{ if not (in $steps $step) }}{{ $steps = $steps | append $step }}{{ end }}
130138
{{ end }}
131139
<section class="mt-4">
132-
<h3 class="h5 mb-2">{{ i18n "hardware_instructions" | default "Instructions" }}</h3>
140+
{{ $instructionsTitle := i18n "hardware_instructions" | default "Instructions" }}
141+
{{ $instructionsID := anchorize $instructionsTitle }}
142+
<h3 class="h5 mb-2" id="{{ $instructionsID }}">
143+
<a class="header-anchor" href="#{{ $instructionsID }}" aria-hidden="true">🔗</a>
144+
{{ $instructionsTitle }}
145+
</h3>
133146
{{ range $stepOrder }}
134147
{{ $step := . }}
135148
{{ if in $steps $step }}
136149
{{ $title := or (index $titleMap $step) (title (replace $step "-" " ")) }}
137-
<h4 class="h6 mt-3 mb-1">{{ $title }}</h4>
150+
{{ $stepID := printf "instruction-%s" (anchorize $title) }}
151+
<h4 class="h6 mt-3 mb-1" id="{{ $stepID }}">
152+
<a class="header-anchor" href="#{{ $stepID }}" aria-hidden="true">🔗</a>
153+
{{ $title }}
154+
</h4>
138155
{{ with (index $introMap $step) }}<p class="text-muted small mb-2">{{ . }}</p>{{ end }}
139156
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-3 mb-3">
140157
{{ range $screens }}

0 commit comments

Comments
 (0)