I just made a figure shortcode which can embed a page resource and be called several ways (if I made the syntax awkward, advice is welcome)
{{< figure src="foo.webp" caption="Awesome words" />}}
{{< figure caption="Awesome words" >}}
{{< resource "foo.webp" >}}
{{< /figure >}}
{{< figure "Awesome words" >}}
<!-- in case I want to make a sort of "subfigure" setup by nesting -->
{{< resource "foo.webp" >}}
{{< /figure >}}
{{< figure src="foo.webp" />}} <!-- fallback to .Title of the resource -->
The captions are rendered markdown, and it works great. But sometimes I have a caption that’s long enough to span multiple lines. I also sometimes need to put markdown code blocks inside the caption. I couldn’t see if there was a way to escape backticks inside a multiline string.
{{< figure src="words.webp" caption=`
My very awesome and long caption. Use
a \`command spelled precisely like this\`. Need
another line because this is too long.
`/>}}
This is what I was hoping for, but it doesn’t work and seems to just end the string.
{{< backtick caption="Hello **world**" >}}
{{< ml caption=`Laborum voluptate <backtick>pariatu</backtick> ex culpa magna nostrud est incididunt fugiat pariatur do dolor ipsum enim. Consequat tempor
do dolor eu. Non id id anim anim excepteur excepteur pariatur nostrud qui irure ullamco.` >}}
{{< backtick caption=`
My very awesome and long caption. Use
a <backtick>command spelled precisely like this</backtick>. Need
another line because this is too long.
` >}}
{{< backtick caption=`
That works also if the <backtick>backtick is not closed
on the same line</backtick> and with multiple instances.My very awesome and long caption. Use
a <backtick>command spelled precisely like this</backtick>. Need
another line because this is too long.
` >}}
which will render as:
<p>
Hello <strong>world</strong>
</p>
<p>
Laborum voluptate <code>pariatu</code> ex culpa magna nostrud est incididunt fugiat pariatur do dolor ipsum enim. Consequat tempor
do dolor eu. Non id id anim anim excepteur excepteur pariatur nostrud qui irure ullamco.
</p>
<p>
My very awesome and long caption. Use
a <code>command spelled precisely like this</code>. Need
another line because this is too long.
</p>
<p>
That works also if the <code>backtick is not closed on the same line</code> and with multiple instances.My very awesome and long caption. Use
a <code>command spelled precisely like this</code>. Need
another line because this is too long.
</p>