From fc9e6efb80da6a646c966c77b1db0deee0975dca Mon Sep 17 00:00:00 2001 From: rxchi1d Date: Mon, 29 Dec 2025 19:26:13 +0800 Subject: [PATCH] fix(render-blockquote): preserve custom title casing --- layouts/_default/_markup/render-blockquote.html | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/layouts/_default/_markup/render-blockquote.html b/layouts/_default/_markup/render-blockquote.html index 6a8e5afa..18df6cb9 100644 --- a/layouts/_default/_markup/render-blockquote.html +++ b/layouts/_default/_markup/render-blockquote.html @@ -33,11 +33,19 @@ {{- $normalizedType := index $typeMap $rawType | default $rawType -}} {{- $iconName := .Attributes.icon | default (index $iconMap $normalizedType) | default "circle-info" -}} - {{- $admonitionTitle := .AlertTitle | default (i18n (printf "admonition.%s" $normalizedType) | default $normalizedType) -}} + {{- $rawCustomTitle := .AlertTitle | default "" -}} + {{- $trimmedCustomTitle := strings.TrimSpace $rawCustomTitle -}} + {{- $hasCustomTitle := ne $trimmedCustomTitle "" -}} + {{- $defaultTitle := i18n (printf "admonition.%s" $normalizedType) | default $normalizedType -}} + {{- $admonitionTitle := cond $hasCustomTitle $rawCustomTitle $defaultTitle -}} {{- $containerClass := "admonition relative overflow-hidden rounded-lg border-l-4 my-3 px-4 py-3 shadow-sm" -}} - {{- $headerClass := "flex items-center gap-2 font-semibold text-inherit capitalize" -}} + {{- $headerClass := "flex items-center gap-2 font-semibold text-inherit" -}} {{- $contentClass := "admonition-content mt-3 text-base leading-relaxed text-inherit" -}} + {{- $titleClass := "grow" -}} + {{- if not $hasCustomTitle -}} + {{- $titleClass = printf "%s %s" $titleClass "capitalize" -}} + {{- end -}} {{- $isCollapsible := in (slice "+" "-") .AlertSign -}} {{- if $isCollapsible -}} @@ -49,7 +57,7 @@
{{- partial "icon.html" $iconName -}}
-
+
{{ $admonitionTitle }}
{{- partial "icon.html" $iconName -}}
-
+
{{ $admonitionTitle }}