remove left anchor option and adjust spacing

This commit is contained in:
Robert Kaussow 2020-09-07 21:51:04 +02:00
parent 30a8cb9d28
commit f84375f21c
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61
6 changed files with 12 additions and 42 deletions

View File

@ -1,2 +1,5 @@
- BREAKING
- remove `geekblogAnchorLeft`;
for a better spacing left-side anchors were removed
- INTERNAL - INTERNAL
- upgrade CI pipeline to use Hugo v0.74.3 - upgrade CI pipeline to use Hugo v0.74.3

View File

@ -29,5 +29,3 @@ params:
geekdocLegalNotice: https://thegeeklab.de/legal-notice/#contact-information geekdocLegalNotice: https://thegeeklab.de/legal-notice/#contact-information
geekdocPrivacyPolicy: https://thegeeklab.de/legal-notice/#privacy-policy geekdocPrivacyPolicy: https://thegeeklab.de/legal-notice/#privacy-policy
geekdocAnchorLeft: true

View File

@ -72,9 +72,6 @@ enableGitInfo = true
# (Optional, default true) Add an anchor link to headlines. # (Optional, default true) Add an anchor link to headlines.
geekdocAnchor = true geekdocAnchor = true
# (Optional, default false) Move anchor link to the left side of headlines.
geekdocAnchorLeft = false
# (Optional, default true) Copy anchor url to clipboard on click. # (Optional, default true) Copy anchor url to clipboard on click.
geekdocAnchorCopy = true geekdocAnchorCopy = true
``` ```
@ -154,9 +151,6 @@ params:
# (Optional, default true) Add an anchor link to headlines. # (Optional, default true) Add an anchor link to headlines.
geekdocAnchor: true geekdocAnchor: true
# (Optional, default false) Move anchor link to the left side of headlines.
geekdocAnchorLeft: false
# (Optional, default true) Copy anchor url to clipboard on click. # (Optional, default true) Copy anchor url to clipboard on click.
geekdocAnchorCopy: true geekdocAnchorCopy: true
``` ```

View File

@ -1,10 +1,7 @@
{{ $showAnchor := (and (default true .Page.Params.GeekdocAnchor) (default true .Site.Params.GeekdocAnchor)) }} {{ $showAnchor := (and (default true .Page.Params.GeekdocAnchor) (default true .Site.Params.GeekdocAnchor)) }}
{{ $anchorLeft := (default false .Site.Params.GeekdocAnchorLeft) }}
{{ $.Scratch.Set "content" (.Content | replaceRE `<nav id="TableOfContents">\s*<ul>\s*<li>\s*<ul>` `<nav id="TableOfContents"><ul>` | replaceRE `</ul>\s*</li>\s*</ul>\s*</nav>` `</ul></nav>` | safeHTML) }} {{ $.Scratch.Set "content" (.Content | replaceRE `<nav id="TableOfContents">\s*<ul>\s*<li>\s*<ul>` `<nav id="TableOfContents"><ul>` | replaceRE `</ul>\s*</li>\s*</ul>\s*</nav>` `</ul></nav>` | safeHTML) }}
{{ if and $showAnchor $anchorLeft }} {{ if $showAnchor }}
{{ $.Scratch.Set "content" ($.Scratch.Get "content" | replaceRE "(<h[2-9] id=\"([^\"]+)\"[^>]*>)(.*?)(</h[2-9]+>)" (printf `<div class="gdoc-page__anchorwrap">%s<a data-clipboard-text="%s" class="gdoc-page__anchor gdoc-page__anchor--left clip" aria-label="Anchor %s" href="#%s"><svg class="icon link"><use xlink:href="#link"></use></svg></a>%s%s</div>` `${1}` (absURL (printf "%s#%s" .Permalink `${2}`)) `${3}` `${2}` `${3}` `${4}`) | safeHTML) }}
{{ else if and $showAnchor (not $anchorLeft) }}
{{ $.Scratch.Set "content" ($.Scratch.Get "content" | replaceRE "(<h[2-9] id=\"([^\"]+)\"[^>]*>)(.*?)(</h[2-9]+>)" (printf `<div class="gdoc-page__anchorwrap">%s%s<a data-clipboard-text="%s" class="gdoc-page__anchor gdoc-page__anchor--right clip" aria-label="Anchor %s" href="#%s"><svg class="icon link"><use xlink:href="#link"></use></svg></a>%s</div>` `${1}` `${3}` (absURL (printf "%s#%s" .Permalink `${2}`)) `${3}` `${2}` `${4}`) | safeHTML) }} {{ $.Scratch.Set "content" ($.Scratch.Get "content" | replaceRE "(<h[2-9] id=\"([^\"]+)\"[^>]*>)(.*?)(</h[2-9]+>)" (printf `<div class="gdoc-page__anchorwrap">%s%s<a data-clipboard-text="%s" class="gdoc-page__anchor gdoc-page__anchor--right clip" aria-label="Anchor %s" href="#%s"><svg class="icon link"><use xlink:href="#link"></use></svg></a>%s</div>` `${1}` `${3}` (absURL (printf "%s#%s" .Permalink `${2}`)) `${3}` `${2}` `${4}`) | safeHTML) }}
{{ end }} {{ end }}

View File

@ -77,6 +77,7 @@ img {
width: 100%; width: 100%;
max-width: $container-max-width; max-width: $container-max-width;
margin: 0 auto; margin: 0 auto;
padding: $padding-16;
} }
.icon { .icon {
@ -108,10 +109,6 @@ img {
width: $font-size-16 * 2; width: $font-size-16 * 2;
height: $font-size-16 * 2; height: $font-size-16 * 2;
} }
.container {
padding: $padding-16;
}
} }
.gdoc-brand { .gdoc-brand {
@ -128,7 +125,7 @@ img {
nav { nav {
width: $menu-width; width: $menu-width;
padding: $padding-16 * 1.5 $padding-16; padding: $padding-16 $padding-32 $padding-16 0;
> ul > li > * { > ul > li > * {
font-weight: normal; font-weight: normal;
@ -199,7 +196,7 @@ img {
.gdoc-page { .gdoc-page {
min-width: $body-min-width; min-width: $body-min-width;
flex-grow: 1; flex-grow: 1;
padding: $padding-16 * 1.5 $padding-16; padding: $padding-16 0;
&__header, &__header,
&__footer { &__footer {
@ -222,7 +219,7 @@ img {
} }
&__footer { &__footer {
margin-top: $padding-16 * 2; margin-top: $padding-32;
a:hover { a:hover {
text-decoration: none; text-decoration: none;
@ -330,10 +327,6 @@ img {
color: $color-link-footer; color: $color-link-footer;
} }
} }
.container {
padding: $padding-16;
}
} }
.gdoc-search { .gdoc-search {
@ -361,7 +354,7 @@ img {
&__input { &__input {
width: 100%; width: 100%;
padding: $padding-8; padding: $padding-8;
padding-left: $padding-16 * 2; padding-left: $padding-32;
border: 1px solid $gray-200; border: 1px solid $gray-200;
border-radius: $border-radius; border-radius: $border-radius;
@ -474,20 +467,12 @@ img {
margin-left: -$menu-width; margin-left: -$menu-width;
font-size: $font-size-base; font-size: $font-size-base;
nav {
padding: $padding-16 * 1.5 $padding-16 * 2;
}
&__control { &__control {
display: inline-block; display: inline-block;
} }
} }
.gdoc-header { .gdoc-header {
.container {
padding: $padding-16 $padding-16 * 2;
}
.icon { .icon {
width: $font-size-16 * 1.5; width: $font-size-16 * 1.5;
height: $font-size-16 * 1.5; height: $font-size-16 * 1.5;
@ -511,7 +496,7 @@ img {
} }
&__message { &__message {
padding-left: $padding-16 * 2; padding-left: $padding-32;
} }
&__line { &__line {
@ -528,15 +513,7 @@ img {
display: none; display: none;
} }
.gdoc-page {
padding: $padding-16 * 1.5 $padding-16 * 2;
}
.gdoc-footer { .gdoc-footer {
.container {
padding: $padding-16 $padding-16 * 2;
}
&__item { &__item {
width: 100%; width: 100%;
} }

View File

@ -3,6 +3,7 @@ $padding-1: 1px !default;
$padding-4: 0.25rem !default; $padding-4: 0.25rem !default;
$padding-8: 0.5rem !default; $padding-8: 0.5rem !default;
$padding-16: 1rem !default; $padding-16: 1rem !default;
$padding-32: 2rem !default;
$font-size-base: 16px !default; $font-size-base: 16px !default;
$font-size-12: 0.75rem !default; $font-size-12: 0.75rem !default;
@ -46,7 +47,7 @@ $second-color: rgba(47, 51, 62, 1) !default;
$header-height: 3.5rem !default; $header-height: 3.5rem !default;
$menu-width: 16rem !default; $menu-width: 16rem !default;
$sm-breakpoint: $menu-width + $body-min-width !default; $sm-breakpoint: $menu-width + $body-min-width + 3rem !default;
// Panel colors // Panel colors
$hint-colors: ( $hint-colors: (