fix: add scroll margin for h1s

h1 elements with IDs need a scroll margin to account for the header and
margin height. These anchors are linked automatically by Algolia.

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
David Karlsson 2023-11-23 12:27:31 +01:00
parent 5e479472d4
commit 210ac7bb11
5 changed files with 5 additions and 5 deletions

View File

@ -14,7 +14,7 @@
{{ partial "breadcrumbs.html" . }} {{ partial "breadcrumbs.html" . }}
<article class="DocSearch-content prose max-w-none dark:prose-invert"> <article class="DocSearch-content prose max-w-none dark:prose-invert">
{{ with .Title }} {{ with .Title }}
<h1 id="{{ anchorize . }}">{{ . }}</h1> <h1 id="{{ anchorize . }}" class="scroll-mt-36">{{ . }}</h1>
{{ end }} {{ end }}
{{ $data.short | .RenderString (dict "display" "block") }} {{ $data.short | .RenderString (dict "display" "block") }}
{{ if $data.deprecated }} {{ if $data.deprecated }}

View File

@ -6,7 +6,7 @@
{{ partial "breadcrumbs.html" . }} {{ partial "breadcrumbs.html" . }}
<article class="DocSearch-content prose max-w-none dark:prose-invert"> <article class="DocSearch-content prose max-w-none dark:prose-invert">
{{ with .Title }} {{ with .Title }}
<h1 id="{{ anchorize . }}">{{ . }}</h1> <h1 id="{{ anchorize . }}" class="scroll-mt-36">{{ . }}</h1>
{{ end }} {{ end }}
<table> <table>
<thead> <thead>

View File

@ -6,7 +6,7 @@
{{ partial "breadcrumbs.html" . }} {{ partial "breadcrumbs.html" . }}
<article class="DocSearch-content prose max-w-none dark:prose-invert"> <article class="DocSearch-content prose max-w-none dark:prose-invert">
{{ with .Title }} {{ with .Title }}
<h1 id="{{ anchorize . }}">{{ . }}</h1> <h1 id="{{ anchorize . }}" class="scroll-mt-36">{{ . }}</h1>
{{ end }} {{ end }}
{{ .Content }} {{ .Content }}
</article> </article>

View File

@ -6,7 +6,7 @@
{{ partial "breadcrumbs.html" . }} {{ partial "breadcrumbs.html" . }}
<article class="DocSearch-content prose max-w-none dark:prose-invert"> <article class="DocSearch-content prose max-w-none dark:prose-invert">
{{ with .Title }} {{ with .Title }}
<h1 id="{{ anchorize . }}">{{ . }}</h1> <h1 id="{{ anchorize . }}" class="scroll-mt-36">{{ . }}</h1>
{{ end }} {{ end }}
{{ .Content }} {{ .Content }}
</article> </article>

View File

@ -6,7 +6,7 @@
{{ partial "breadcrumbs.html" . }} {{ partial "breadcrumbs.html" . }}
<article class="DocSearch-content prose max-w-none dark:prose-invert"> <article class="DocSearch-content prose max-w-none dark:prose-invert">
{{ with .Title }} {{ with .Title }}
<h1 id="{{ anchorize . }}">{{ . }}</h1> <h1 id="{{ anchorize . }}" class="scroll-mt-36">{{ . }}</h1>
{{ end }} {{ end }}
<blockquote> <blockquote>
<p><strong>Note</strong></p> <p><strong>Note</strong></p>