From e629d1560741ab1cfa0e292b52c28826d1e01ad3 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Wed, 19 May 2021 00:00:57 +0200 Subject: [PATCH] feat: add page parameter geekdocAlign to control a pages text alignment (#130) --- exampleSite/content/_index.md | 3 +- exampleSite/content/usage/configuration.md | 6 ++++ layouts/_default/list.html | 2 +- layouts/_default/single.html | 2 +- src/sass/_markdown.scss | 38 ++++++++++++++++++++++ 5 files changed, 48 insertions(+), 3 deletions(-) diff --git a/exampleSite/content/_index.md b/exampleSite/content/_index.md index 0184754..7e0f44a 100644 --- a/exampleSite/content/_index.md +++ b/exampleSite/content/_index.md @@ -1,7 +1,8 @@ --- -title: Documentation +title: Welcome to the documentation description: Geekdoc is a simple Hugo theme for documentations. It is intentionally designed as a fast and lean theme and may not fit the requirements of complex projects. If a more feature-complete theme is required there are a lot of got alternatives out there. geekdocNav: false +geekdocAlign: center --- diff --git a/exampleSite/content/usage/configuration.md b/exampleSite/content/usage/configuration.md index 36350e6..186b89d 100644 --- a/exampleSite/content/usage/configuration.md +++ b/exampleSite/content/usage/configuration.md @@ -248,6 +248,9 @@ geekdocAnchor = true # page from search data, feeds, etc. # WARNING: Consider hosting a standalone, fully auth-protected static page for secret information instead! geekdocProtected = false + +# Set 'left' (default), 'center' or 'right' to configure the text align of a page. +geekdocAlign = "left" ``` {{< /tab >}} @@ -305,6 +308,9 @@ geekdocAnchor: true # page from search data, feeds, etc. # WARNING: Consider hosting a standalone, fully auth-protected static page for secret information instead! geekdocProtected: false + +# Set 'left' (default), 'center' or 'right' to configure the text align of a page. +geekdocAlign: "left" ``` {{< /tab >}} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index a9c05e6..95c7d7b 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,6 +1,6 @@ {{ define "main" }} {{ partial "page-header" . }} -
+

{{ partial "title" . }}

{{ partial "content" . }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 33d452c..c27218b 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,7 +1,7 @@ {{ define "main" }} {{ partial "page-header" . }} -
+

{{ partial "title" . }}

{{ partial "content" . }}
diff --git a/src/sass/_markdown.scss b/src/sass/_markdown.scss index 55c9ce1..10da821 100644 --- a/src/sass/_markdown.scss +++ b/src/sass/_markdown.scss @@ -178,4 +178,42 @@ overflow: auto; max-height: var(--code-max-height); } + + &__align { + &--left { + h1, + h2, + h3, + h4, + h5, + h6 { + justify-content: flex-start; + } + text-align: left; + } + + &--center { + h1, + h2, + h3, + h4, + h5, + h6 { + justify-content: center; + } + text-align: center; + } + + &--right { + h1, + h2, + h3, + h4, + h5, + h6 { + justify-content: flex-end; + } + text-align: right; + } + } }