From b7e9c6166b1b59baecf5b171cec4e9ba533810e9 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Tue, 7 May 2024 10:25:52 +0800 Subject: [PATCH] :sparkles: Feat: add capitalize automatic headings config at `params.page.heading.capitalize` (#421) --- hugo.toml | 2 ++ layouts/_default/_markup/render-heading.html | 3 +++ layouts/partials/init/index.html | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hugo.toml b/hugo.toml index 3223468e..1dc94438 100644 --- a/hugo.toml +++ b/hugo.toml @@ -694,6 +694,8 @@ enableEmoji = true closeComment = false # FixIt 0.3.0 | NEW page heading config [params.page.heading] + # FixIt 0.3.3 | NEW whether to capitalize automatic text of headings + capitalize = false # used with `markup.tableOfContents.ordered` parameter [params.page.heading.number] # whether to enable auto heading numbering diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html index e40df06a..787df770 100644 --- a/layouts/_default/_markup/render-heading.html +++ b/layouts/_default/_markup/render-heading.html @@ -54,6 +54,9 @@ {{- $title = replace $title "{h6}" $h6 -}} {{- $title = replace $title "{title}" .Text -}} {{- end -}} + {{- if $params.heading.capitalize -}} + {{- $title = replace $title .PlainText (title .PlainText) -}} + {{- end -}} {{ $title | safeHTML }} diff --git a/layouts/partials/init/index.html b/layouts/partials/init/index.html index 3565cff4..2973ae89 100644 --- a/layouts/partials/init/index.html +++ b/layouts/partials/init/index.html @@ -1,4 +1,4 @@ -{{- .Scratch.Set "version" "v0.3.5" -}} +{{- .Scratch.Set "version" "v0.3.6-RC" -}} {{- .Scratch.Set "this" dict -}} {{- partial "init/detection-env.html" . -}}