Jump to content

Markdown in Image Descriptions not rendering


Michael Murphy
 Share

Recommended Posts

I want to allow extra markup in the image description field (for basic formatting and links etc.). I have added Markdown to the "Text formatters (for file descriptions)" on the Images field, but it does not seem to be rendering the markdown in my templates.

Processwire version :  2.5.8 dev

Modifications : I have ProcessCropImage and the Language support for Fields and Page Names installed

When i try to render the image description in my template :



echo $image->description;


It shows the text and seems to recognise and strip out the markdown tags (e.g. **This** becomes This), but does not actually render any html. 

Any ideas what is going wrong? It kind of makes sense that the default behaviour does not output any html (in case you use it as image alt text for example), so maybe there is an extra way to render the markup?

Thanks for any help.

Link to comment
Share on other sites

Don't know why it is not working, can't test right now.

You could to it manually, though:

$desc = $image->description;
echo $modules->get('TextformatterMarkdownExtra')->format($desc);

Edit: just tested it, can confirm the Textformatter is not applied automatically. Still don't know why :)

Edit 2: Just tested further, the Texformatter is there, checking via $fields->get('image')->textformatters but the format method is NOT called.

Probably a bug.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...