Components get unwanted <p> tags after Zola 0.23 migration
Bug Report
I've built a website for an author and I used some shortcodes to handle repetitive bits of HTML. For example, this was templates/shortcodes/coverlink.html:
{% set thumb = resize_image(path=img, width=300, height=450, op="fit") %}
{% set dest = get_url(path=dest) %}
<a href="{{dest}}"><img src="{{ thumb.url }}" alt="{{ title }}" /></a>And it was used like so:
<div class="covers">
{{ coverlink(img="kimmy/cover.jpg", title="Kimmy", dest="@/kimmy/_index.md") }}
{{ coverlink(img="show-girl/cover.jpg", title="Show Girl", dest="@/show-girl/_index.md") }}
{{ coverlink(img="the-sisters-of-dorley/1-welcome-to-dorley-hall.jpg", title="The Sisters of Dorley", dest="@/the-sisters-of-dorley/_index.md") }}
{{ coverlink(img="when-you-fell-from-heaven/cover.jpg", title="When You Fell From Heaven", dest="@/when-you-fell-from-heaven/_index.md") }}
</div>The output HTML was this:
<div class=covers>
<a href=https://alysongreaves.com/kimmy/><img alt=Kimmy src=https://alysongreaves.com/processed_images/cover.dd3ae866ab59dbb6.jpg></a>
<a href=https://alysongreaves.com/show-girl/><img alt="Show Girl" src=https://alysongreaves.com/processed_images/cover.bb35e53d8833d0fe.jpg></a>
<a href=https://alysongreaves.com/the-sisters-of-dorley/><img alt="The Sisters of Dorley" src=https://alysongreaves.com/processed_images/1-welcome-to-dorley-hall.49627c01a23078a4.jpg></a>
<a href=https://alysongreaves.com/when-you-fell-from-heaven/><img alt="When You Fell From Heaven" src=https://alysongreaves.com/processed_images/cover.ef59fd942a2b108b.jpg></a>
</div>Now that 0.23 has removed shortcodes and macros, we're directed to use components instead.
So I defined this component:
{% component coverlink(img:string, title:string, dest:string) %}
{% set thumb = resize_image(path=img, width=300, height=450, op="fit") %}
{% set dest = get_url(path=dest) %}
<a href="{{dest}}"><img src="{{ thumb.url }}" alt="{{ title }}" /></a>
{% endcomponent coverlink %}And used it like so:
<div class="covers">
{{ <coverlink img="kimmy/cover.jpg" title="Kimmy" dest="@/kimmy/_index.md" /> }}
{{ <coverlink img="show-girl/cover.jpg" title="Show Girl" dest="@/show-girl/_index.md" /> }}
{{ <coverlink img="the-sisters-of-dorley/1-welcome-to-dorley-hall.jpg" title="The Sisters of Dorley" dest="@/the-sisters-of-dorley/_index.md" /> }}
{{ <coverlink img="when-you-fell-from-heaven/cover.jpg" title="When You Fell From Heaven" dest="@/when-you-fell-from-heaven/_index.md" /> }}
</div>And the output I get is this:
<div class=covers>
<p><a href=https://alysongreaves.com/kimmy /><img alt=Kimmy src=https://alysongreaves.com/processed_images/cover.dd3ae866ab59dbb6.jpg></a>
<p><a href=https://alysongreaves.com/show-girl /><img alt="Show Girl" src=https://alysongreaves.com/processed_images/cover.bb35e53d8833d0fe.jpg></a>
<p><a href=https://alysongreaves.com/the-sisters-of-dorley /><img alt="The Sisters of Dorley" src=https://alysongreaves.com/processed_images/1-welcome-to-dorley-hall.49627c01a23078a4.jpg></a>
<p><a href=https://alysongreaves.com/when-you-fell-from-heaven /><img alt="When You Fell From Heaven" src=https://alysongreaves.com/processed_images/cover.ef59fd942a2b108b.jpg></a>
</div>I'm assuming based on #3224 that this is because the component is getting substituted in before the markdown rendering, and some blank lines get inserted. So following https://keats.github.io/tera/#whitespace-control I changed the component to this:
{%- component coverlink(img:string, title:string, dest:string) -%}
{%- set thumb = resize_image(path=img, width=300, height=450, op="fit") -%}
{%- set dest = get_url(path=dest) -%}
<a href="{{dest}}"><img src="{{ thumb.url }}" alt="{{ title }}" /></a>
{%- endcomponent coverlink -%}And then the rendered HTML doesn't have the extraneous <p> tags.
However this requirement was very much not obvious from the (minimal) docs about migrating shortcodes. Please give more examples on the best way to do things.
Environment
Zola version: 0.23.3
Source: getzola/zola