Merge branch 'dev' into feature/callout-tailwind

This commit is contained in:
ZhenShuo Leo
2025-12-23 01:21:40 +08:00
58 changed files with 1719 additions and 923 deletions
@@ -0,0 +1,10 @@
{{- $title := or .Attributes.title "" -}}
{{- $lang := or .Type "text" -}}
<div class="highlight-wrapper">
{{- with $title -}}
<div class="codeblock-title">
{{- $title -}}
</div>
{{- end -}}
{{- transform.Highlight .Inner $lang .Options -}}
</div>
+27 -8
View File
@@ -1,11 +1,30 @@
<a
href="{{ .Destination | safeURL }}"
{{- with .Title -}}
title="{{ . }}"
{{- end }}
{{- if or (strings.HasPrefix .Destination "http:") (strings.HasPrefix .Destination "https:") }}
target="_blank"
{{ end }}>
{{/* From Hugo, Apache v2 license
https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_markup/render-link.html
*/}}
{{- $u := urls.Parse .Destination -}}
{{- $href := $u.String -}}
{{- if strings.HasPrefix $u.String "#" -}}
{{- $href = printf "%s#%s" .PageInner.RelPermalink $u.Fragment -}}
{{- else if and $href (not $u.IsAbs) -}}
{{- $path := strings.TrimPrefix "./" $u.Path -}}
{{- with or
($.PageInner.GetPage $path)
($.PageInner.Resources.Get $path)
(resources.Get $path)
-}}
{{- $href = .RelPermalink -}}
{{- with $u.RawQuery -}}
{{- $href = printf "%s?%s" $href . -}}
{{- end -}}
{{- with $u.Fragment -}}
{{- $href = printf "%s#%s" $href . -}}
{{- end -}}
{{- end -}}
{{- end -}}
<a href="{{ $href }}" {{ with .Title }}title="{{ . }}"{{ end }}
{{- if or (strings.HasPrefix .Destination "http:") (strings.HasPrefix .Destination "https:") }} target="_blank"{{ end }}>
{{- .Text | safeHTML -}}
</a>
{{- /* Trim EOF */ -}}
+1 -1
View File
@@ -11,7 +11,7 @@
{{ $bodyLayout := "flex flex-col h-screen m-auto leading-7 max-w-7xl px-6 sm:px-14 md:px-24 lg:px-32" }}
{{ $bodyColor := "text-lg bg-neutral text-neutral-900 dark:bg-neutral-800 dark:text-neutral" }}
{{ $bodyScrollbar := "scrollbar-thin scrollbar-track-neutral-200 scrollbar-thumb-neutral-400 dark:scrollbar-track-neutral-800 dark:scrollbar-thumb-neutral-600" }}
<body class="{{ $bodyLayout }} {{ $bodyColor }} {{ $bodyScrollbar }}">
<body class="{{ $bodyLayout }} {{ $bodyColor }} {{ if site.Params.enableStyledScrollbar | default true }}{{ $bodyScrollbar }}{{ end }}">
<div id="the-top" class="absolute flex self-center">
<a
class="px-3 py-1 text-sm -translate-y-8 rounded-b-lg bg-primary-200 focus:translate-y-0 dark:bg-neutral-600"
+1 -1
View File
@@ -51,7 +51,7 @@
</div>
</div>
{{ end }}
<div class="min-w-0 min-h-0 max-w-prose">
<div class="min-w-0 min-h-0 max-w-prose w-full">
{{ .Content }}
</div>
</section>
@@ -18,7 +18,7 @@
{{ $cardContentClasses := "" }}
{{ if site.Params.list.showCards }}
{{ $cardClasses = printf "%s overflow-hidden rounded-md border-2 border-neutral-200 dark:border-neutral-700" $cardClasses }}
{{ $cardClasses = printf "%s overflow-hidden rounded-lg border border-neutral-300 dark:border-neutral-600" $cardClasses }}
{{ $imgWrapperClasses = "" }}
{{ $cardContentClasses = printf "%s p-4 pt-2" $cardContentClasses }}
{{ else }}
@@ -85,7 +85,7 @@
<div class="flex-none relative overflow-hidden {{ $imgWrapperClasses }} thumbnail">
<img
src="{{ . }}"
alt="{{ with $target.Params.featuredImageAlt }}{{ . }}{{ else }}{{ $target.Title | emojify }}{{ end }}"
role="presentation"
loading="lazy"
decoding="async"
class="not-prose absolute inset-0 w-full h-full object-cover">
@@ -51,12 +51,12 @@
<article
class="relative min-h-full min-w-full overflow-hidden rounded border border-2 border-neutral-200 shadow-2xl dark:border-neutral-700">
class="relative min-h-full min-w-full overflow-hidden rounded-lg border border-neutral-300 dark:border-neutral-600">
{{ with $featuredURL }}
<div class="flex-none relative overflow-hidden thumbnail_card_related">
<img
src="{{ . }}"
alt="{{ $page.Title }}"
role="presentation"
loading="lazy"
decoding="async"
fetchpriority="low"
@@ -68,7 +68,7 @@
{{ partial "badge.html" (i18n "article.draft" | emojify) }}
</span>
{{ end }}
<div class="px-6 py-4">
<div class="p-4">
<header>
<a
{{ with $page.Params.externalUrl }}
+3 -3
View File
@@ -55,12 +55,12 @@
<article
class="relative min-h-full min-w-full overflow-hidden rounded border border-2 border-neutral-200 shadow-2xl dark:border-neutral-700">
class="relative min-h-full min-w-full overflow-hidden rounded-lg border border-neutral-300 dark:border-neutral-600">
{{ with $featuredURL }}
<div class="flex-none relative overflow-hidden thumbnail_card">
<img
src="{{ . }}"
alt="{{ $page.Title | plainify }}"
role="presentation"
loading="lazy"
decoding="async"
class="not-prose absolute inset-0 w-full h-full object-cover">
@@ -71,7 +71,7 @@
{{ partial "badge.html" (i18n "article.draft" | emojify) }}
</span>
{{ end }}
<div class="px-6 py-4">
<div class="p-4">
<header>
<a
{{ with $page.Params.externalUrl }}
+3 -3
View File
@@ -10,8 +10,8 @@
{{ $imgWrapperClasses := "" }}
{{ $cardContentClasses := "" }}
{{ if site.Params.list.showCards }}
{{ $cardClasses = printf "%s overflow-hidden rounded-md border-2 border-neutral-200 dark:border-neutral-700" $cardClasses }}
{{ if .Params.showCards | default site.Params.list.showCards }}
{{ $cardClasses = printf "%s overflow-hidden rounded-lg border border-neutral-300 dark:border-neutral-600" $cardClasses }}
{{ $imgWrapperClasses = "" }}
{{ $cardContentClasses = printf "%s p-4" $cardContentClasses }}
{{ else }}
@@ -78,7 +78,7 @@
<div class="flex-none relative overflow-hidden {{ $imgWrapperClasses }} thumbnail">
<img
src="{{ . }}"
alt="{{ $.Params.featuredImageAlt | default ($.Title | emojify) }}"
role="presentation"
loading="lazy"
decoding="async"
class="not-prose absolute inset-0 w-full h-full object-cover">
+1 -1
View File
@@ -10,7 +10,7 @@
{{ if $authorImage }}
{{ $final := $authorImage }}
{{ $squareImage := $authorImage }}
{{ if not $disableImageOptimization }}
{{ if not (or $disableImageOptimization (eq $authorImage.MediaType.SubType "svg")) }}
{{ $final = $authorImage.Fill "192x192" }}
{{ $shortSide := int (math.Min $authorImage.Width $authorImage.Height) }}
{{ $squareImage = $authorImage.Crop (printf "%dx%d" $shortSide $shortSide ) }}
+1 -1
View File
@@ -10,7 +10,7 @@
{{ if $authorImage }}
{{ $final := $authorImage }}
{{ $squareImage := $authorImage }}
{{ if not $disableImageOptimization }}
{{ if not (or $disableImageOptimization (eq $authorImage.MediaType.SubType "svg")) }}
{{ $final = $authorImage.Fill "192x192" }}
{{ $shortSide := int (math.Min $authorImage.Width $authorImage.Height) }}
{{ $squareImage = $authorImage.Crop (printf "%dx%d" $shortSide $shortSide ) }}
+1 -1
View File
@@ -99,7 +99,7 @@
{{/* CSS */}}
{{ $cssResources := slice }}
{{ $schemeName := .Site.Params.colorScheme | default "blowfish" }}
{{ $cssScheme := resources.Get (printf "css/schemes/%s.css" $schemeName) | default (resources.Get "css/schemes/blowfish.css") }}
{{ $cssScheme := resources.Get (printf "css/schemes/%s.css" (lower $schemeName)) | default (resources.Get "css/schemes/blowfish.css") }}
{{ $cssResources = $cssResources | append $cssScheme }}
{{ $cssResources = $cssResources | append (resources.Get "css/compiled/main.css") }}
{{ with resources.Get "css/custom.css" }}
+2 -2
View File
@@ -69,7 +69,7 @@
<img
id="background-image"
src="{{ . }}"
alt="{{ $.Title }}"
role="presentation"
loading="eager"
decoding="async"
fetchpriority="high"
@@ -84,7 +84,7 @@
{{ if $shouldBlur | default false }}
<div
id="background-blur"
class="fixed opacity-0 inset-x-0 top-0 h-full single_hero_background nozoom backdrop-blur-2xl"></div>
class="fixed opacity-0 inset-x-0 top-0 h-full single_hero_background nozoom backdrop-blur-xl bg-neutral-100/75 dark:bg-neutral-800/60"></div>
{{ $backgroundBlur := resources.Get "js/background-blur.js" }}
{{ $backgroundBlur = $backgroundBlur | resources.Minify | resources.Fingerprint ($.Site.Params.fingerprintAlgorithm | default "sha512") }}
<script
+1 -1
View File
@@ -53,7 +53,7 @@
<div class="overflow-hidden h-36 md:h-56 lg:h-72">
<img
src="{{ . }}"
alt="{{ with $.Params.featureimagealt }}{{ . }}{{ else }}{{ with $.Title }}Featured image for {{ . }}{{ else }}Featured image{{ end }}{{ end }}"
role="presentation"
loading="eager"
decoding="async"
fetchpriority="high"
@@ -87,7 +87,7 @@
<div class="overflow-hidden rounded-md h-36 md:h-56 lg:h-72 nozoom">
<img
src="{{ . }}"
alt="{{ $.Title }}"
role="presentation"
loading="eager"
decoding="async"
fetchpriority="high"
@@ -107,7 +107,6 @@
<img
id="background-image-main"
src="{{ . }}"
alt=""
role="presentation"
loading="eager"
decoding="async"
@@ -124,7 +123,7 @@
{{ if $shouldBlur | default false }}
<div
id="background-blur"
class="fixed opacity-0 inset-x-0 top-0 h-full single_hero_background nozoom backdrop-blur-2xl"></div>
class="fixed opacity-0 inset-x-0 top-0 h-full single_hero_background nozoom backdrop-blur-xl bg-neutral-100/75 dark:bg-neutral-800/60"></div>
{{ $backgroundBlur := resources.Get "js/background-blur.js" }}
{{ $backgroundBlur = $backgroundBlur | resources.Minify | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }}
<script
+2 -2
View File
@@ -52,7 +52,7 @@
{{ if $authorImage }}
{{ $final := $authorImage }}
{{ $squareImage := $authorImage }}
{{ if not $disableImageOptimization }}
{{ if not (or $disableImageOptimization (eq $authorImage.MediaType.SubType "svg")) }}
{{ $final = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }}
{{ $shortSide := int (math.Min $authorImage.Width $authorImage.Height) }}
{{ $squareImage = $authorImage.Crop (printf "%dx%d" $shortSide $shortSide ) }}
@@ -105,7 +105,7 @@
{{ if .Site.Params.homepage.layoutBackgroundBlur | default false }}
<div
id="background-blur"
class="fixed opacity-0 inset-x-0 top-0 h-full single_hero_background nozoom backdrop-blur-2xl"></div>
class="fixed opacity-0 inset-x-0 top-0 h-full single_hero_background nozoom backdrop-blur-xl bg-neutral-100/75 dark:bg-neutral-800/60"></div>
{{ $backgroundBlur := resources.Get "js/background-blur.js" }}
{{ $backgroundBlur = $backgroundBlur | resources.Minify | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }}
<script
+1 -1
View File
@@ -55,7 +55,7 @@
{{ if $authorImage }}
{{ $final := $authorImage }}
{{ $squareImage := $authorImage }}
{{ if not $disableImageOptimization }}
{{ if not (or $disableImageOptimization (eq $authorImage.MediaType.SubType "svg")) }}
{{ $final = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }}
{{ $shortSide := int (math.Min $authorImage.Width $authorImage.Height) }}
{{ $squareImage = $authorImage.Crop (printf "%dx%d" $shortSide $shortSide ) }}
+1 -1
View File
@@ -14,7 +14,7 @@
{{ if $authorImage }}
{{ $final := $authorImage }}
{{ $squareImage := $authorImage }}
{{ if not $disableImageOptimization }}
{{ if not (or $disableImageOptimization (eq $authorImage.MediaType.SubType "svg")) }}
{{ $final = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }}
{{ $shortSide := int (math.Min $authorImage.Width $authorImage.Height) }}
{{ $squareImage = $authorImage.Crop (printf "%dx%d" $shortSide $shortSide ) }}
+15 -12
View File
@@ -49,22 +49,25 @@
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{{- $breadcrumbs := slice -}}
{{- $position := 0 -}}
{{- range .Ancestors -}}
{{- if not .IsHome -}}
{{- $breadcrumbs = $breadcrumbs | append . -}}
{{- $position = add $position 1 -}}
{
"@type": "ListItem",
"position": {{ $position }},
"name": "{{ .Title }}",
"item": {{ .Permalink }}
},
{{- end -}}
{{- end -}}
{{- $breadcrumbs = $breadcrumbs | append . -}}
{{- range $index, $element := $breadcrumbs -}}
{
"@type": "ListItem",
"position": {{ add $index 1 }},
"name": "{{ .Title }}",
"item": {{ .Permalink }},
}{{ if ne (add $index 1) (len $breadcrumbs) }},{{ end }}
{{- end -}}
{{- $position = add $position 1 -}}
{
"@type": "ListItem",
"position": {{ $position }},
"name": "{{ .Title }}",
"item": {{ .Permalink }}
}
]
}{{ end }}]
</script>
+8
View File
@@ -145,3 +145,11 @@
}}
<link rel="stylesheet" href="{{ $repoCardCSS.RelPermalink }}" integrity="{{ $repoCardCSS.Data.Integrity }}">
{{ end }}
{{/* tabs */}}
{{ if .Page.HasShortcode "tabs" }}
{{ $tabJS := resources.Get "js/shortcodes/tabs.js" }}
{{ with $tabJS | minify | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }}
<script src="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script>
{{ end }}
{{ end }}
+2 -3
View File
@@ -19,6 +19,7 @@
{{ end }}
<div class="width-patch"></div>
<div
id="{{ $id }}"
class="relative"
@@ -49,9 +50,7 @@
data-twe-carousel-item
style="transition-duration: {{ $interval }}ms;"
{{ if eq $index 0 }}data-twe-carousel-active{{ end }}>
<div
class="single_hero_background"
style="aspect-ratio: {{ $aspectx }} / {{ $aspecty }};">
<div class="single_hero_background" style="aspect-ratio: {{ $aspectx }} / {{ $aspecty }};">
<img
src="{{ $image.RelPermalink }}"
class="block absolute top-0 object-cover w-full h-full not-prose nozoom"
+1
View File
@@ -26,6 +26,7 @@
{{ end -}}
<div class="width-patch"></div>
<div id="{{- $id -}}" class="gallery">
{{ $content | safeHTML -}}
</div>
+7
View File
@@ -0,0 +1,7 @@
{{- $label := .Get "label" -}}
{{- $index := .Parent.Store.Get "tab-index" | default 0 -}}
{{- $content := .InnerDeindent | strings.TrimSpace | .Page.RenderString -}}
{{- $tabs := .Parent.Store.Get "tabs" | default slice -}}
{{- .Parent.Store.Set "tabs" ($tabs | append (dict "label" $label "content" $content)) -}}
{{- .Parent.Store.Set "tab-index" (add 1 $index) -}}
+28
View File
@@ -0,0 +1,28 @@
{{- .Store.Set "tab-index" 0 -}}
{{- $noop := .Inner -}}
<div class="tab__container w-full">
<div class="tab__nav" role="tablist">
<div class="flex gap-1 overflow-x-auto">
{{- range $nTabs, $_ := .Store.Get "tabs" -}}
<button
class="tab__button px-3 py-2 text-sm font-semibold border-b-2 border-transparent rounded-t-md hover:bg-neutral-200 dark:hover:bg-neutral-700 {{ if eq $nTabs 0 }}
tab--active
{{ end }}"
role="tab"
aria-selected="{{ cond (eq $nTabs 0) "true" "false" }}"
data-tab-index="{{ $nTabs }}">
{{ index . "label" }}
</button>
{{- end -}}
</div>
</div>
<div class="tab__content mt-4">
{{- range $nTabs, $_ := .Store.Get "tabs" -}}
<div class="tab__panel {{ if eq $nTabs 0 }}tab--active{{ end }}" data-tab-index="{{ $nTabs }}">
{{ index . "content" }}
</div>
{{- end -}}
</div>
</div>