Shortcodes within shortcodes renders linebreaks as <p>

Thanks, your solution definitely works, though I already have unsafe = true set in the config. I exchanged my code step by step with yours and found that my img-shortcode is the problem, since it works fine if I replace it with yours. (cute cat btw!)

Here is the full version of my img-shortcode that only works if I remove all line-breaks:

{{ $src := .Get "src" }}
{{ $image := resources.Get $src }}
{{ $alt := .Get "alt" }}
{{ $width := .Get "width" }}
{{ $height := .Get "height" }}
{{ $noZoom := .Get "no-zoom" }}
{{ if not $alt  }}
{{ $alt = "" }}
{{ end }}
<div>
{{ if and (not $width) (not $height)  }}
    {{ if ($image) }}
        {{ $thumb := $image.Fit "1000x400 webp q100" }}
        {{ $thumbTablet := $image.Fit "800x400 webp q100" }}
        {{ $thumbMobile := $image.Fit "500x400 webp" }}
<img height="{{ $thumb.Height }}"
        width="{{ $thumb.Width }}"
        style="max-width: min(1000px, 100%);object-fit: contain;height: fit-content;"
        alt="{{ $alt }}"
        srcset="{{$thumb.RelPermalink}} 1000w,
            {{$thumbTablet.RelPermalink}} 800w,
            {{$thumbMobile.RelPermalink}} 500w"
        sizes="100vw"
        src="{{ $thumbMobile.RelPermalink }}"
        original-src="{{ $image.RelPermalink }}"
        {{ if (not $noZoom) }}
        onClick="zoomImage(this.getAttribute('original-src'))"
        {{ else }}
        class="no-zoom"
        {{ end }}
>
    {{ else }}
<img style="max-width: 100%; max-height: 400px;" alt="{{ $alt }}" src="{{ $src }}" onClick="zoomImage({{ $src }})">
    {{ end }}
{{ else }}
    {{ if ($image) }}
<img height="{{ $height }}" width="{{ $width }}" alt="{{ $alt }}" src="{{ $image.RelPermalink }}" original-src="{{ $image.RelPermalink }}" 
        {{ if (not $noZoom) }}
        onClick="zoomImage(this.getAttribute('original-src'))"
        {{ else }}
        class="no-zoom"
        {{ end }}
>
    {{ else }}
<img height="{{ $height }}" width="{{ $width }}" alt="{{ $alt }}" src="{{ $src }}" 
        {{ if (not $noZoom) }}
        onClick="zoomImage({{ $src }})"
        {{ else }}
        class="no-zoom"
        {{ end }}>
    {{ end }}
{{ end }}
</div>