Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
texnixe opened this issue Feb 24, 2019 · 6 comments
Closed

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

texnixe opened this issue Feb 24, 2019 · 6 comments
Assignees
Labels
type: enhancement ✨ Suggests an enhancement; improves Kirby
Milestone

Comments

@texnixe
Copy link
Member

texnixe commented Feb 24, 2019

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

@texnixe texnixe changed the title Markdown in image tag caption not working Markdown in image tag caption not rendered Feb 24, 2019
@bastianallgeier
Copy link
Member

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

@lukasbestle
Copy link
Member

lukasbestle commented Feb 25, 2019

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
Copy link
Member Author

texnixe commented Feb 25, 2019

Anker tags definitely worked in K2...

@texnixe
Copy link
Member Author

texnixe commented Feb 25, 2019

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

@texnixe
Copy link
Member Author

texnixe commented Mar 1, 2019

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 distantnative added the type: enhancement ✨ Suggests an enhancement; improves Kirby label Mar 6, 2019
@distantnative distantnative changed the title Markdown in image tag caption not rendered [KirbyTags] Markdown in image tag caption not rendered Mar 6, 2019
@distantnative distantnative modified the milestones: 3.2.0, 3.1.3 Mar 17, 2019
@distantnative distantnative modified the milestones: 3.1.4, 3.2.0 Apr 16, 2019
@distantnative distantnative self-assigned this May 11, 2019
@distantnative distantnative modified the milestones: 3.2.0, 3.1.4 May 11, 2019
@distantnative
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement ✨ Suggests an enhancement; improves Kirby
Projects
None yet
Development

No branches or pull requests

4 participants