update theme

This commit is contained in:
Christoph Cullmann 2025-07-18 21:45:32 +02:00
parent fc43dba964
commit 93fea0ed81
No known key found for this signature in database
183 changed files with 6015 additions and 6241 deletions

View file

@ -1,12 +1,10 @@
{{ $strAnchor := urlize .Anchor }}
{{ $replacedAnchor := replaceRE "%25" "" $strAnchor }}
{{ $anchor := anchorize .Anchor }}
<h{{ .Level }} class="relative group">{{ .Text | safeHTML }}
<div id="{{ .Anchor | safeURL | urlize }}" class="anchor"></div>
{{ if.Page.Params.showHeadingAnchors | default (.Page.Site.Params.article.showHeadingAnchors | default true) }}
<div id="{{ $anchor }}" class="anchor"></div>
{{ if .Page.Params.showHeadingAnchors | default (.Page.Site.Params.article.showHeadingAnchors | default true) }}
<span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
<a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700"
style="text-decoration-line: none !important;" href="#{{ $replacedAnchor | safeURL }}" aria-label="{{ i18n "article.anchor_label" }}">#</a>
<a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#{{ $anchor }}" aria-label="{{ i18n "article.anchor_label" }}">#</a>
</span>
{{ end }}
</h{{ .Level }}>

View file

@ -1,48 +1,55 @@
{{- $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
{{ define "RenderImageSimple" -}}
<img class="my-0 rounded-md" loading="lazy" alt="{{ .alt }}" src="{{ .src }}">
{{- end }}
{{ define "RenderImageResponsive" -}}
<img
class="my-0 rounded-md"
loading="lazy"
decoding="async"
fetchpriority="low"
alt="{{ .alt }}"
srcset="
{{ (.resource.Resize "330x").RelPermalink }} 330w,
{{ (.resource.Resize "660x").RelPermalink }} 660w,
{{ (.resource.Resize "1280x").RelPermalink }} 1280w
"
data-zoom-src="{{ .resource.RelPermalink }}"
src="{{ .resource.RelPermalink }}">
{{- end }}
{{ define "RenderImageCaption" -}}
{{- with .caption }}
<figcaption>{{ . | markdownify }}</figcaption>
{{- end }}
{{- end }}
{{- $disableImageOptimizationMD := .Page.Site.Params.disableImageOptimizationMD | default false }}
{{- $url := urls.Parse .Destination }}
{{- $altText := .Text }}
{{- $caption := .Title }}
{{- if findRE "^https?" $url.Scheme }}
<figure>
<img class="my-0 rounded-md" loading="lazy" src="{{ $url.String }}" alt="{{ $altText }}" />
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
</figure>
{{- else }}
{{- $resource := "" }}
{{- if $.Page.Resources.GetMatch ($url.String) }}
{{- $resource = $.Page.Resources.GetMatch ($url.String) }}
{{- else if resources.GetMatch ($url.String) }}
{{- $resource = resources.Get ($url.String) }}
{{- end }}
{{- with $resource }}
<figure>
{{- if or $disableImageOptimization (eq .MediaType.SubType "svg")}}
<img
class="my-0 rounded-md"
loading="lazy"
src="{{ .RelPermalink }}"
alt="{{ $altText }}"
/>
{{- else }}
<img
class="my-0 rounded-md"
loading="lazy"
srcset="
{{ (.Resize "330x").RelPermalink }} 330w,
{{ (.Resize "660x").RelPermalink }} 660w,
{{ (.Resize "1024x").RelPermalink }} 1024w,
{{ (.Resize "1320x").RelPermalink }} 2x"
data-zoom-src="{{ (.Resize "1320x").RelPermalink }}"
src="{{ (.Resize "660x").RelPermalink }}"
alt="{{ $altText }}"
/>
{{- end }}
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
</figure>
{{- else }}
<figure>
<img class="my-0 rounded-md" loading="lazy" src="{{ $url.String }}" alt="{{ $altText }}" />
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
</figure>
{{- end }}
{{- $isRemote := findRE "^https?" $url.Scheme }}
{{- $resource := "" }}
{{- if not $isRemote }}
{{- $resource = or ($.Page.Resources.GetMatch $url.String) (resources.Get $url.String) }}
{{- end }}
<figure>
{{- if $isRemote }}
{{ template "RenderImageSimple" (dict "src" $url.String "alt" $altText) }}
{{- else if $resource }}
{{- $isSVG := eq $resource.MediaType.SubType "svg" }}
{{- $shouldOptimize := and (not $disableImageOptimizationMD) (not $isSVG) }}
{{- if $shouldOptimize }}
{{ template "RenderImageResponsive" (dict "resource" $resource "alt" $altText) }}
{{- else }}
{{ template "RenderImageSimple" (dict "src" $resource.RelPermalink "alt" $altText) }}
{{- end }}
{{- else }}
{{ template "RenderImageSimple" (dict "src" $url.String "alt" $altText) }}
{{- end }}
{{ template "RenderImageCaption" (dict "caption" $caption) }}
</figure>

View file

@ -1,7 +1,11 @@
<a href="{{ .Destination | safeURL }}"
{{- with .Title -}}
<a
href="{{ .Destination | safeURL }}"
{{- with .Title -}}
title="{{ . }}"
{{- end }}
{{- if or (strings.HasPrefix .Destination "http:") (strings.HasPrefix .Destination "https:") }} target="_blank"{{ end }}>
{{- .Text | safeHTML -}}
</a>
{{- end }}
{{- if or (strings.HasPrefix .Destination "http:") (strings.HasPrefix .Destination "https:") }}
target="_blank"
{{ end }}>
{{- .Text | safeHTML -}}
</a>
{{- /* Trim EOF */ -}}