From 8384e09033f0fdd00af3c872c6ad097bd63914fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Codru=C8=9B=20Constantin=20Gu=C8=99oi?= Date: Mon, 25 Jan 2021 20:13:58 +0000 Subject: [PATCH] Adds anchors to all headings (#439) --- assets/scss/_base.scss | 18 ++++++++++++++++++ assets/scss/_base_dark.scss | 18 ++++++++++++++++++ layouts/_default/_markup/render-heading.html | 6 ++++++ layouts/partials/list.html | 12 +++++++----- layouts/partials/page.html | 6 +++++- layouts/partials/posts/series.html | 7 ++++++- layouts/posts/list.html | 6 +++++- layouts/posts/single.html | 6 +++++- ...ss_1fcd9040f1144c65015c77e7b93bc5ac.content | 2 +- ....scss_1fcd9040f1144c65015c77e7b93bc5ac.json | 2 +- ...ss_5e1eb8e37c42cdfb6215b61e44dcfa5f.content | 2 +- ....scss_5e1eb8e37c42cdfb6215b61e44dcfa5f.json | 2 +- 12 files changed, 74 insertions(+), 13 deletions(-) create mode 100644 layouts/_default/_markup/render-heading.html diff --git a/assets/scss/_base.scss b/assets/scss/_base.scss index 2c00d63..5d13cef 100644 --- a/assets/scss/_base.scss +++ b/assets/scss/_base.scss @@ -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 { diff --git a/assets/scss/_base_dark.scss b/assets/scss/_base_dark.scss index e14e502..c05ed2c 100644 --- a/assets/scss/_base_dark.scss +++ b/assets/scss/_base_dark.scss @@ -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 { diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html new file mode 100644 index 0000000..712241b --- /dev/null +++ b/layouts/_default/_markup/render-heading.html @@ -0,0 +1,6 @@ + + {{ .Text | safeHTML }} + + + + diff --git a/layouts/partials/list.html b/layouts/partials/list.html index b4877b2..26986a2 100644 --- a/layouts/partials/list.html +++ b/layouts/partials/list.html @@ -1,11 +1,13 @@

- {{- if eq .Kind "term" -}} - {{- i18n .Data.Singular | title -}} - {{- print ": " -}} - {{- end -}} + + {{- if eq .Kind "term" -}} + {{- i18n .Data.Singular | title -}} + {{- print ": " -}} + {{- end -}} - {{- .Title -}} + {{- .Title -}} +

{{ .Content }}