getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.32k stars 168 forks source link

[KirbyTags] Markdown in image tag caption not rendered #1501

Closed texnixe closed 5 years ago

texnixe commented 5 years ago

Describe the bug When using markdown in a caption within an image KirbyTag e.g. (image: myimage.jpg caption: This is an *awesome* image), it is not parsed but rendered as is.

To Reproduce Steps to reproduce the behavior:

  1. Put the above tag into a page
  2. Visit page in frontend
  3. See output

Expected behavior Markdown should be parsed

Kirby Version 3.0.2

And since we are at it: HTML tags within captions aren't rendered, either: https://forum.getkirby.com/t/tags-in-figcaption-in-kirby3/13038/2

bastianallgeier commented 5 years ago

Do you remember if we had the same behavior in v2? Just trying to find out if it's a regression.

lukasbestle commented 5 years ago

Nope, in v2 it was escaped as well (and no KirbyText was rendered): https://github.com/getkirby-v2/kirby/blob/2.5.12/extensions/tags.php#L150 I wonder why the behavior is still different between v2 and v3.

texnixe commented 5 years ago

Anker tags definitely worked in K2...

texnixe commented 5 years ago

Making Markdown work would make sense, event though that didn't work in K2, either.

texnixe commented 5 years ago

The second issue with the link tags not rendering can be fixed by providing an array as the second parameter to Html::figure() method in kirby/config/tags.php:

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

If we just pass a string, the string is html::encode()d with the tags being stripped, line #376 kirby/src/toolkit/Html.php

If that's an acceptable solution, I have create a PR.

distantnative commented 5 years ago