From b1168b98dca26d31a5d44c9b8b8070059d3302e4 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Fri, 13 Aug 2021 17:17:32 +1000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Move=20heading=20anchors=20to=20?= =?UTF-8?q?render=20hook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/css/main.css | 12 +++++++----- layouts/_default/_markup/render-heading.html | 1 + layouts/_default/single.html | 2 +- layouts/partials/head.html | 1 - layouts/partials/heading-anchor.html | 1 - static/css/main.css | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 layouts/_default/_markup/render-heading.html delete mode 100644 layouts/partials/heading-anchor.html diff --git a/assets/css/main.css b/assets/css/main.css index bec0ac1d..daf510e1 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -9,20 +9,22 @@ /* Heading anchors */ .prose .heading-anchor { - @apply absolute top-0 w-6 no-underline opacity-0 -left-6; + @apply absolute top-0 no-underline opacity-0; + width: 1.1em; + left: -1.1em; } .prose .heading-anchor:hover { - @apply underline bg-transparent opacity-100 text-primary-600; + @apply underline bg-transparent text-primary-600; } -.prose h2:focus > .heading-anchor, +.prose .heading-anchor:hover, +.prose .heading-anchor:focus, .prose h2:hover > .heading-anchor, -.prose h3:focus > .heading-anchor, .prose h3:hover > .heading-anchor, -.prose h4:focus > .heading-anchor, .prose h4:hover > .heading-anchor { @apply opacity-100; } +/* Prose escape hatch */ .no-prose > p { @apply mt-0 last:mb-0; } diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html new file mode 100644 index 00000000..ff5ea9fc --- /dev/null +++ b/layouts/_default/_markup/render-heading.html @@ -0,0 +1 @@ +{{ .Text | safeHTML }} # diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 43f1604c..e83838fc 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -7,7 +7,7 @@
- {{ partial "heading-anchor.html" .Content | emojify }} + {{ .Content | emojify }}