The blank lines come from paige/code commands {{ }}. if you use {{- -}} they are gone.
Looks like the minification does not handle the content of (at least) your shortcode.
if you call the shortcode using {{% code .. %}}notation the blank lines vanish
{{/*
Returns a minified copy of the given string.
Note that this partial template returns a string, so you may have to pass the
result through one of the safe functions (e.g., safe.HTML, safe.CSS).
@param {string} text The string to minify.
@param {string} [format=html] The format of the string to minify, one of css, html, js, json, svg, or xml.
@returns {string}
@example: {{ partial "minify.html" (dict "text" .Content) }}
@example: {{ partial "minify.html" (dict "text" .Content "format" "html") }}
*/}}
{{ $partialName := "minify.html" }}
{{ $result := "" }}
{{ $text := or .text "" }}
{{ $format := or .format "html" }}
{{ $supportedFormats := slice
"css"
"html"
"js"
"json"
"svg"
"xml"
}}
{{ if in $supportedFormats $format }}
{{ with $.text }}
{{ $cacheKey := printf "%s.%s" (hash.XxHash .) $format }}
{{ with resources.FromString $cacheKey . }}
{{ with . | resources.Minify }}
{{ $result = .Content }}
{{ end }}
{{ end }}
{{ end }}
{{ else }}
{{ errorf "The %q partial does not support the %q format." $partialName $format }}
{{ end }}
{{ return $result }}
layouts/_default/list.rss.xml
...
{{- range $pages }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
<guid>{{ .Permalink }}</guid>
{{- $content := partial "minify.html" (dict "text" .Content "format" "html") }}
<description>{{ printf "<![CDATA[ %s ]]>" $content | safeHTML }}</description>
</item>
{{- end }}
...
Would a template function be easier to use?
{{ .Content | transform.Minify "html" }} ⟶ string
Certainly, but I’m not sure how often it would be used. This is the first time that I can remember anyone asking for this capabilty.
For future readers, it’s important that the temporary resource have a file extension matching the content type, otherwise the minify function will fail.