So I did some research and I'd like to open this as a discussion because I haven't been able to find a good solution to this convention.
Problem
Just like in many other templating languages, I'd like to create a wrapper component template that can be re-used with different content inside the template.
This is in some frameworks referred to as <slot/> or children in react.
With Jinja this pattern is possible with the caller functionality with macros: https://jinja.palletsprojects.com/en/3.0.x/templates/#call
Workaround Example
My current solution is to create 2 macros and put the content in between.
This can however cause a few problems when used incorrectly.
{% call sc::social_card_start("profile", "Beautiful header content goes here") %}
<span> Here I have total freedom unrelated to the rest of the <code>social_card</code> component </span>
{% call sc::social_card_end() %}
{% macro social_card_start(svg, heading) %}
<section class="border rounded-md bg-pink-200 m-4 p-4">
<header class="flex text-center justify-center items-center gap-2 mb-2">
<svg aria-hidden="true" class="h-7 w-7 fill-blue-950">
<use xlink:href="/svg/icons-sprite.svg#{{svg}}" />
</svg>
<h3 class="text-lg font-medium mb-1">{{heading|safe}}</h3>
</header>
{% endmacro %}
{% macro social_card_end() %}
</section>
</section>
{% endmacro %}
Resolution
I've seen that the support for caller was multiple times declined: #996 #930
This brings me to a question: How should I approach creating and using templates that are meant to wrap around different content?