Adds anchors to all headings (#439)

This commit is contained in:
Codruț Constantin Gușoi
2021-01-25 20:13:58 +00:00
committed by GitHub
parent 2ae5eec336
commit 8384e09033
12 changed files with 74 additions and 13 deletions

View File

@@ -47,6 +47,24 @@ h6 {
font-weight: 700;
color: $alt-fg-color;
margin: 6.4rem 0 3.2rem 0;
&:hover .heading-link {
visibility: visible;
}
.heading-link {
color: $link-color;
font-weight: inherit;
text-decoration: none;
font-size: 80%;
visibility: hidden;
}
.title-link {
color: inherit;
font-weight: inherit;
text-decoration: none;
}
}
h1 {

View File

@@ -14,6 +14,24 @@
h5,
h6 {
color: $alt-fg-color-dark;
&:hover .heading-link {
visibility: visible;
}
.heading-link {
color: $link-color-dark;
font-weight: inherit;
text-decoration: none;
font-size: 80%;
visibility: hidden;
}
.title-link {
color: inherit;
font-weight: inherit;
text-decoration: none;
}
}
code {

View File

@@ -0,0 +1,6 @@
<h{{ .Level }} id="{{ .Anchor | safeURL }}">
{{ .Text | safeHTML }}
<a class="heading-link" href="#{{ .Anchor | safeURL }}">
<i class="fa fa-link" aria-hidden="true"></i>
</a>
</h{{ .Level }}>

View File

@@ -1,11 +1,13 @@
<section class="container list">
<h1 class="title">
<a class="title-link" href="{{ .Permalink | safeURL }}">
{{- if eq .Kind "term" -}}
{{- i18n .Data.Singular | title -}}
{{- print ": " -}}
{{- end -}}
{{- .Title -}}
</a>
</h1>
{{ .Content }}
<ul>

View File

@@ -1,7 +1,11 @@
<section class="container page">
<article>
<header>
<h1>{{ .Title }}</h1>
<h1 class="title">
<a class="title-link" href="{{ .Permalink | safeURL }}">
{{ .Title }}
</a>
</h1>
</header>
{{ .Content }}

View File

@@ -5,7 +5,12 @@
{{ $name := . | urlize }}
{{ $series := index $.Site.Taxonomies.series $name }}
{{ if gt (len $series.Pages) 1 }}
<h3>{{ i18n "see_also" | default "See also in" }} {{ . }}</h3>
<h3 id="{{ i18n "see_also" | default "See also in" | anchorize }}-{{ anchorize . | safeURL }}">
{{ i18n "see_also" | default "See also in" }} {{ . }}
<a class="heading-link" href="#{{ i18n "see_also" | default "See also in" | anchorize }}-{{ anchorize . | safeURL }}">
<i class="fa fa-link" aria-hidden="true"></i>
</a>
</h3>
<nav>
<ul>
{{ $maxItems := $.Site.Params.maxSeeAlsoItems | default 5 }}

View File

@@ -3,7 +3,11 @@
{{ end }}
{{ define "content" }}
<section class="container list">
<h1 class="title"> {{ title (i18n (lower .Title)) | default .Title }} </h1>
<h1 class="title">
<a class="title-link" href="{{ .Permalink | safeURL }}">
{{ title (i18n (lower .Title)) | default .Title }}
</a>
</h1>
{{ .Content }}
<ul>
{{- range .Paginator.Pages -}}

View File

@@ -6,7 +6,11 @@
<article>
<header>
<div class="post-title">
<h1 class="title">{{ .Title }}</h1>
<h1 class="title">
<a class="title-link" href="{{ .Permalink | safeURL }}">
{{ .Title }}
</a>
</h1>
</div>
<div class="post-meta">
<div class="date">

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"Target":"css/coder-dark.min.126ad3988d46bdae6217a11105b53c9662bca05f39d42d3c0fb366919d334620.css","MediaType":"text/css","Data":{"Integrity":"sha256-EmrTmI1Gva5iF6ERBbU8lmK8oF851C08D7NmkZ0zRiA="}}
{"Target":"css/coder-dark.min.89c82b6022b96f77aeb521b240daec4f87ea029d84d1c78b8acd0735b91b3c92.css","MediaType":"text/css","Data":{"Integrity":"sha256-icgrYCK5b3eutSGyQNrsT4fqAp2E0ceLis0HNbkbPJI="}}

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"Target":"css/coder.min.6d489c9de70b01718344ed2ac642db21c4bb3c62941cb95963c2b67c66c07fdc.css","MediaType":"text/css","Data":{"Integrity":"sha256-bUicnecLAXGDRO0qxkLbIcS7PGKUHLlZY8K2fGbAf9w="}}
{"Target":"css/coder.min.f48a4da9bd32cecaff90717ae85529411dd087c10fc0dfca9c9c329c7327e5e1.css","MediaType":"text/css","Data":{"Integrity":"sha256-9IpNqb0yzsr/kHF66FUpQR3Qh8EPwN/KnJwynHMn5eE="}}