Shortcodes and indentation

That was the problem in my case. Is there a way to disable this in code-heavy shortcodes? Hard to maintain otherwise.

Are you indenting the shortcode call within markdown, or are you indenting code within a shortcode?

A specific example would be helpful.

Indenting within a shortcode. It looked like this:

<dl>
  {{ range $func, $description := .Site.Data.citekeyformatters.functions }}
    <dt>{{ $func | safeHTML }}</dt><dd>{{ $description | safeHTML }}</dd>
  {{ end }}
</dl>

From what you describe, it sounds like you are calling the shortcode using the {{% %}} notation:

{{% foo %}}

Using this notation, the shortcode is processed as markdown, and anything indented by four or more spaces is treated as an indented code block per the CommonMark specification.

In the example you provide, there is no reason to process this shortcode as markdown, so use this notation instead:

{{< foo >}}
1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.