From 37351acf91027bbd13be3bc46762b982e945e3fd Mon Sep 17 00:00:00 2001 From: Mivinci Date: Wed, 9 Nov 2022 20:51:50 +0800 Subject: [PATCH] standarize configuration --- README.md | 4 +- assets/css/main.scss | 4 ++ assets/css/pre.scss | 1 + assets/css/syntax.scss | 11 +-- assets/css/theme.scss | 6 +- exampleSite/config.yaml | 18 +++-- exampleSite/content/mermaid-diagrams.md | 2 +- layouts/404.html | 6 ++ layouts/partials/comment.html | 67 +++++++++++++++++++ .../partials/{mermaid.html => diagram.html} | 4 +- layouts/partials/disqus.html | 16 ----- layouts/partials/giscus.html | 18 ----- layouts/partials/head.html | 11 ++- layouts/partials/katex.html | 25 ------- layouts/partials/math.html | 29 ++++++++ layouts/partials/plugin.html | 28 ++------ layouts/partials/utterances.html | 8 --- 17 files changed, 150 insertions(+), 108 deletions(-) create mode 100644 layouts/partials/comment.html rename layouts/partials/{mermaid.html => diagram.html} (70%) delete mode 100644 layouts/partials/disqus.html delete mode 100644 layouts/partials/giscus.html delete mode 100644 layouts/partials/katex.html create mode 100644 layouts/partials/math.html delete mode 100644 layouts/partials/utterances.html diff --git a/README.md b/README.md index 0d4e928..8e90dda 100644 --- a/README.md +++ b/README.md @@ -54,8 +54,8 @@ Follow [exampleSite/config.yaml](https://github.com/Mivinci/hugo-theme-minima/bl | categories | array | category list | | series | array | series list | | tags | array | tag list | -| math | bool | enables math formulas rendering | -| mermaid | bool | enables flowcharts rendering | +| math | bool | enables math plugin | +| diagram | bool | enables diagram plugin | | comment | bool | enable comment plugin | | draft | bool | disallow being published | | link | string | a URL to redirect to | diff --git a/assets/css/main.scss b/assets/css/main.scss index 35b3734..32e71ec 100644 --- a/assets/css/main.scss +++ b/assets/css/main.scss @@ -37,6 +37,10 @@ main p a { color: var(--prime); } +main p a:hover { + text-decoration: underline; +} + @keyframes showup { from { opacity: 0; diff --git a/assets/css/pre.scss b/assets/css/pre.scss index bcdd9f8..ea1e211 100644 --- a/assets/css/pre.scss +++ b/assets/css/pre.scss @@ -34,6 +34,7 @@ hr { height: 0; /* 1 */ color: inherit; /* 2 */ border-top-width: 1px; /* 3 */ + border-color: var(--grid, inherit); } /* diff --git a/assets/css/syntax.scss b/assets/css/syntax.scss index 05169a4..dc1cc99 100644 --- a/assets/css/syntax.scss +++ b/assets/css/syntax.scss @@ -1,10 +1,11 @@ -.chroma code { - color: #d4d4d4; +.chroma { + margin: .5em 0; + background-color: #222222; + border-radius: 2px; } -.chroma { - background-color: #222222; - margin: .5em 0; +.chroma code { + color: #d4d4d4; } /* LineTableTD */ diff --git a/assets/css/theme.scss b/assets/css/theme.scss index 35080da..8ed22f8 100644 --- a/assets/css/theme.scss +++ b/assets/css/theme.scss @@ -1,13 +1,15 @@ .light { - --prime: #1691b6; + --prime: #3170a7; --grid: #e1e1e1; --back: #fff; --text: #222; + --code-back: #fff; } .dark { - --prime: #1691b6; + --prime: #3170a7; --back: #181818; --text: silver; --grid: #555; + --code-back: #222; } \ No newline at end of file diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 28f9f87..b10b658 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -52,10 +52,6 @@ params: displayDescription: true # selectable specifies if your post content can be selected. selectable: true - # commentOnAllPosts specifies if the chosen comment plugin to be enabled on all - # post pages. If enabled, those you don't want a comment plugin to work on just - # set `comment` to false in their front matters. - commentOnAllPosts: true # social is an array containing as many as social accounts to be displayed # in the buttom of every page. social: @@ -68,8 +64,19 @@ params: - name: "rss" url: "/index.xml" - # comment specifies a comment plugin. + # math plugin + math: + enable: false + provider: katex + + # diagram plugin + diagram: + enable: false + provider: mermaid + + # comment plugin comment: + enable: true provider: giscus # check out https://disqus.com/ disqus: @@ -90,6 +97,7 @@ params: reactions: true metadata: false + # menu.main is an array containing what is used as the navigator. menu: main: diff --git a/exampleSite/content/mermaid-diagrams.md b/exampleSite/content/mermaid-diagrams.md index 9e4d1c5..aa2ec17 100644 --- a/exampleSite/content/mermaid-diagrams.md +++ b/exampleSite/content/mermaid-diagrams.md @@ -3,7 +3,7 @@ author: Mermaid Team title: Mermaid Diagrams date: 2021-07-18T10:52:59+08:00 description: A brief guide to Mermaid syntax. -mermaid: true +diagram: true tags: - markdown - mermaid diff --git a/layouts/404.html b/layouts/404.html index e69de29..aff5634 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -0,0 +1,6 @@ +{{ define "main" }} +
+

Oops!

+

404 Not Found

+
+{{ end }} \ No newline at end of file diff --git a/layouts/partials/comment.html b/layouts/partials/comment.html new file mode 100644 index 0000000..b7c0441 --- /dev/null +++ b/layouts/partials/comment.html @@ -0,0 +1,67 @@ + +
+ + +{{ if eq .Site.Params.comment.provider "giscus" }} +{{ with .Site.Params.comment.giscus }} + +{{ end }} +{{ end }} + + +{{ if eq .Site.Params.comment.provider "utterances" }} +{{ with .Site.Params.comment.utterances }} + +{{ end }} +{{ end }} + + +{{ if eq .Site.Params.comment.provider "disqus" }} +{{ with .Site.Params.comment.disqus }} +
+ + +{{ end }} +{{ end }} \ No newline at end of file diff --git a/layouts/partials/mermaid.html b/layouts/partials/diagram.html similarity index 70% rename from layouts/partials/mermaid.html rename to layouts/partials/diagram.html index 46667a0..c3bc881 100644 --- a/layouts/partials/mermaid.html +++ b/layouts/partials/diagram.html @@ -1,7 +1,9 @@ +{{ if eq .Site.Params.diagram.provider "mermaid" }} \ No newline at end of file + +{{ end }} \ No newline at end of file diff --git a/layouts/partials/disqus.html b/layouts/partials/disqus.html deleted file mode 100644 index 905a085..0000000 --- a/layouts/partials/disqus.html +++ /dev/null @@ -1,16 +0,0 @@ -
- - \ No newline at end of file diff --git a/layouts/partials/giscus.html b/layouts/partials/giscus.html deleted file mode 100644 index 68579ac..0000000 --- a/layouts/partials/giscus.html +++ /dev/null @@ -1,18 +0,0 @@ -{{ $giscus := .Site.Params.comment.giscus }} - diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 14d454a..0ae50e6 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -30,11 +30,16 @@ - - - - \ No newline at end of file diff --git a/layouts/partials/math.html b/layouts/partials/math.html new file mode 100644 index 0000000..733ed06 --- /dev/null +++ b/layouts/partials/math.html @@ -0,0 +1,29 @@ +{{ if eq .Site.Params.math.provider "katex" }} + + + + + + + +{{ end }} \ No newline at end of file diff --git a/layouts/partials/plugin.html b/layouts/partials/plugin.html index 3528b2c..f8bee83 100644 --- a/layouts/partials/plugin.html +++ b/layouts/partials/plugin.html @@ -1,27 +1,11 @@ - - -{{ if or .Params.math .Site.Params.math }} -{{ partial "katex.html" . }} +{{ if or .Params.math (and .Site.Params.math.enable (ne .Params.math false)) }} +{{ partial "math.html" . }} {{ end }} -{{ if or .Params.mermaid .Site.Params.mermaid }} -{{ partial "mermaid.html" . }} -{{ end }} - -{{ if or .Params.comment (and .Site.Params.commentOnAllPosts (ne .Params.comment false)) }} - -{{ if eq .Site.Params.comment.provider "disqus"}} -{{ partial "disqus.html" . }} -{{ end }} - -{{ if eq .Site.Params.comment.provider "giscus" }} -{{ partial "giscus.html" . }} -{{ end }} - -{{ if eq .Site.Params.comment.provider "utterances"}} -{{ partial "utterances.html" . }} +{{ if or .Params.diagram (and .Site.Params.diagram.enable (ne .Params.diagram false)) }} +{{ partial "diagram.html" . }} {{ end }} +{{ if or .Params.comment (and .Site.Params.comment.enable (ne .Params.comment false)) }} +{{ partial "comment.html" . }} {{ end }} \ No newline at end of file diff --git a/layouts/partials/utterances.html b/layouts/partials/utterances.html deleted file mode 100644 index 8a4325f..0000000 --- a/layouts/partials/utterances.html +++ /dev/null @@ -1,8 +0,0 @@ -