Tags in figcaption in Kirby3

Hello, I have a problem with link in image tag.

In Kirby 2 if I write in a post this:

(image: image.png caption: credits by <a href=“#”>Name</a>)

I see in the page this:

<figure>
<img src="http://myurl/image.png”>
<figcaption>credits by <a href=“#”>Name</a></figcaption>
</figure>

In Kirby 3, I see this:

<figure>
<img src="http://myurl/image.png”>
<figcaption>credits by &lt;a href=“#”>Name&lt;/a&gt;</figcaption>
</figure>

Can I change &lt; in <?

Hm, that looks like a bug to me.

What is a bug? The html generated with &lt; instead of <, is it?

Well, the link show be rendered as correct link, not with those HTML entities…

Can I fix somehow? Or do I need to wait an update?

Thank you for your support.

I’m not quite sure what’s causing this (have to look into it), but you could create a custom KirbyTag in the meantime.

I ran into this with a tag i made the other day, I think its got something to do with white space in the tag, but i haven’t been able to replicate it enough to post an issue. Try stripping all the leading and trailing space inside your tag code. I think Kirby Text is treating the white space as <pre>.

All ive got is that it went away when i tidied the tag up by removing blank lines and leading / trailing space.

Quick fix, change $tag->caption in line #129 in /kirby/config/tags.php to[$tag->caption]`

return Html::figure([ $link($image) ],  [$tag->caption] , [
  'class' => $tag->class
]);

@texnixe The current thread is about the built in tags, but for me it happened with the code in this post, which also uses Html::figure.

I think because the snippet code has enough leading spaces on some lines to trigger markdown pre. It doesn’t happen with the final snippet at the end of the thread. I will post an issue if i can reliably replicate it again. I guess it could be a problem with Html::figure since thats the common element here.

@texnixe thanks. It works :grinning:

Fixed in 3.1.4

Thanks. I updated :slight_smile: