Michael Murphy Posted December 3, 2014 Share Posted December 3, 2014 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 More sharing options...
owzim Posted December 3, 2014 Share Posted December 3, 2014 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. 1 Link to comment Share on other sites More sharing options...
Michael Murphy Posted December 4, 2014 Author Share Posted December 4, 2014 Thanks for testing @owzim, much appreciated. I guess this is a bug, so I will open an issue on github (unless someone else has an idea). Link to comment Share on other sites More sharing options...
Michael Murphy Posted December 15, 2014 Author Share Posted December 15, 2014 This issue was fixed in the latest dev branch - 2.5.10 dev. Thanks Ryan! 1 Link to comment Share on other sites More sharing options...
Marty Walker Posted February 9, 2015 Share Posted February 9, 2015 Hmmm. I'm running 2.5.18 and I can't get this working the way I need it to. Bold, italic etc works but I'm trying to add a link. I've tried Markdown Extra as well as owzims Parsedown textformatters and no go. [link](http://www.smd.net.au) Link to comment Share on other sites More sharing options...
Marty Walker Posted February 9, 2015 Share Posted February 9, 2015 For anyone interested this was the only way I could get it working. <? $page->of(false); $desc = $page->images_single->description; $page->of(true); echo $modules->get('TextformatterMarkdownExtra')->format($desc); 4 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now