From f9db0acd6353cf93c5fdb5e409b174dcbf247e34 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Thu, 27 Feb 2020 09:50:11 +0100 Subject: [PATCH] add option to move anchor links in front of headlines --- layouts/partials/content.html | 7 +++++-- src/sass/_base.scss | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/layouts/partials/content.html b/layouts/partials/content.html index 6d93e3f..1ca0cb3 100644 --- a/layouts/partials/content.html +++ b/layouts/partials/content.html @@ -1,8 +1,11 @@ {{ $showAnchor := (and (default true .Page.Params.GeekdocAnchor) (default true .Site.Params.GeekdocAnchor)) }} +{{ $anchorLeft := (default false .Site.Params.GeekdocAnchorLeft) }} {{ $.Scratch.Set "content" (.Content | replaceRE `` `` | safeHTML) }} -{{ if $showAnchor }} - {{ $.Scratch.Set "content" ($.Scratch.Get "content" | replaceRE "()" `${1}  ${3}` | safeHTML) }} +{{ if and $showAnchor $anchorLeft }} + {{ $.Scratch.Set "content" ($.Scratch.Get "content" | replaceRE "(]*>)(.*?)()" `${1}${3}${4}` | safeHTML) }} +{{ else if and $showAnchor (not $anchorLeft) }} + {{ $.Scratch.Set "content" ($.Scratch.Get "content" | replaceRE "(]*>)(.*?)()" `${1}${3}${4}` | safeHTML) }} {{ end }} {{ $.Scratch.Get "content" }} diff --git a/src/sass/_base.scss b/src/sass/_base.scss index d4d778a..1aff497 100644 --- a/src/sass/_base.scss +++ b/src/sass/_base.scss @@ -222,8 +222,19 @@ img { } } - &__anchor .icon { - color: $gray-400; + &__anchor{ + &--left { + min-width: 35px; + text-align: left; + } + + &--right { + margin-left: 0.5em; + } + + .icon { + color: $gray-400; + } } }