From 0417a92524d58685b328a6cfa650d06e931ad054 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Sat, 16 Aug 2025 22:32:26 +0200 Subject: fix: remove render image hook breaking Markdown attrs for images --- README.md | 2 ++ layouts/_default/_markup/render-image.html | 58 ------------------------------ 2 files changed, 2 insertions(+), 58 deletions(-) delete mode 100644 layouts/_default/_markup/render-image.html diff --git a/README.md b/README.md index b231275..745f0e0 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ Tastefejl is a fork of the [Typo] Hugo theme, with the following changes: * Replaced the default footer saying *Powered by Hugo and tomfran/typo* with `` tags because nobody cares. +* Removed the render image hook that broke Markdown attributes for images (can be enabled with `markup.goldmark.parser.attribute.block = true`). + * Removed [Simple Icons] because I don't want to plaster brands on my website and at one point a 50MB .html file was committed (I filtered the git history to reduce the size of the repository.) diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html deleted file mode 100644 index a1bc158..0000000 --- a/layouts/_default/_markup/render-image.html +++ /dev/null @@ -1,58 +0,0 @@ -{{/* -To get page resources and relative paths to work. Copied as is from default -hook: -https://github.com/gohugoio/hugo/blob/89bd02/tpl/tplimpl/embedded/templates/_default/_markup/render-image.html -*/}} -{{- $u := urls.Parse .Destination -}} -{{- $url := $u.String -}} -{{- $imgResource := .Page.Scratch.Get "typoNilVariable" -}} -{{- if not $u.IsAbs -}} - {{- $path := strings.TrimPrefix "./" $u.Path -}} - {{/* Check if this is a page bundle or standalone page */}} - {{- if .PageInner.Resources -}} - {{- $imgResource = .PageInner.Resources.Get $path -}} - {{- else if (or .PageInner.Parent .PageInner.Parent.Resources) -}} - {{- $imgResource = .PageInner.Parent.Resources.Get $path -}} - {{- end -}} - {{- $imgResource := or $imgResource (resources.Get $path) -}} - {{- with $imgResource -}} - {{- $url = .RelPermalink -}} - {{- with $u.RawQuery -}} - {{- $url = printf "%s?%s" $url . -}} - {{- end -}} - {{- with $u.Fragment -}} - {{- $url = printf "%s#%s" $url . -}} - {{- end -}} - {{- end -}} -{{- end -}} - -{{/* Split URL at # */}} -{{ $url = $url | safeURL }} -{{ $file_name_array := split $url "#" }} - -{{/* -Iterate over all tags, which are in pos 1 to len array - 1, -and build the img class string as "img-tag1 img-tag2 ..." -*/}} - -{{ $classes := "" }} - -{{ range $idx := seq (sub (len $file_name_array) 1) }} -{{ $tag := index $file_name_array $idx }} -{{ $classes = printf "%s img-%s" $classes $tag}} -{{ end }} - - -{{/* Use the computed classes on the rendered figure */}} -
- -
- {{ .Text }} -
- - {{ with .Title }} -
-
{{ . | markdownify}}
-
- {{ end }} -
-- cgit v1.2.3