Minification template tags for shortcodes

I have the feeling that there are no “minification template markers” for shortcode template codes. I am talking about the - markers in tags in Go templates.

This here does not work:

{{- < shortcodename > -}}
{{- % shortcodename % -}}

Is there any way to simulate minification for shortcodes or would that maybe be a feature that was overlooked before and is easily implementable?

My thought is that shortcodes occur in content while the whitespace markers occur in layouts.
I could see minifying within the shortcode’s .html but I’m curious why you need minification in your content (shortcode call)?

I am pretty sure it’s an OCD thing :wink: You are right, it’s in the markdown. I realized somewhere along the lines that my shortcodes weren’t minifying when I did something like table-column-shortcodes inside of table-row-shortcodes. It’s probably doable inside of the shortcodes. It would be nice though if the following would be manageable to be minified into a single line:

{{< table >}}
  {{< row >}}
    {{< column >}}bla{{</column}}
    {{< column >}}bla{{</column}}
    {{< column >}}bla{{</column}}
  {{</row >}}
{{< /table >}}
1 Like

Would using something like (this is just an untested idea):

{{- /* Remove leading newlines */ -}}
<td>{{ .Inner }}</td>
{{- /* Remove trailing newlines */ -}}

do the job?