diff options
author | Christoph Cullmann <cullmann@kde.org> | 2024-04-28 17:33:09 +0200 |
---|---|---|
committer | Christoph Cullmann <cullmann@kde.org> | 2024-04-28 17:33:09 +0200 |
commit | e77051ccc4b47951bfa4fde2be436b1bb2fb113b (patch) | |
tree | f0b75ee3521da9c8cd39dac4359212348f70e4e8 /themes/blowfish/layouts/_default/_markup | |
parent | 4b355837824ac2422d371acef790f0f4249255c7 (diff) |
use https://github.com/nunocoracao/blowfish.git
Diffstat (limited to 'themes/blowfish/layouts/_default/_markup')
3 files changed, 61 insertions, 0 deletions
diff --git a/themes/blowfish/layouts/_default/_markup/render-heading.html b/themes/blowfish/layouts/_default/_markup/render-heading.html new file mode 100644 index 0000000..ccc8377 --- /dev/null +++ b/themes/blowfish/layouts/_default/_markup/render-heading.html @@ -0,0 +1,12 @@ +{{ $strAnchor := urlize .Anchor }} +{{ $replacedAnchor := replaceRE "%25" "" $strAnchor }} +<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) }} + <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> + </span> + {{ end }} +</h{{ .Level }}> diff --git a/themes/blowfish/layouts/_default/_markup/render-image.html b/themes/blowfish/layouts/_default/_markup/render-image.html new file mode 100644 index 0000000..db9ebd2 --- /dev/null +++ b/themes/blowfish/layouts/_default/_markup/render-image.html @@ -0,0 +1,47 @@ +{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | 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 $disableImageOptimization }} + <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" + 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 }} +{{ end }} diff --git a/themes/blowfish/layouts/_default/_markup/render-link.html b/themes/blowfish/layouts/_default/_markup/render-link.html new file mode 100644 index 0000000..8336169 --- /dev/null +++ b/themes/blowfish/layouts/_default/_markup/render-link.html @@ -0,0 +1,2 @@ +<a href="{{ .Destination | safeURL }}" {{ with .Title}} title="{{ . }}"{{ end }} {{ if or (strings.HasPrefix .Destination "http:") (strings.HasPrefix .Destination "https:") }} target="_blank"{{ end }}> + {{ .Text | safeHTML }}</a>
\ No newline at end of file |