Can't get markdown to work - newbie

Hi Everyone,

I’m following the “Pluralsight - Building a Real time Web App course” which is great.

In the course they register a helper like this in “main,js” on the client side:

UI.registerHelper(“markdown”, function (text) {
var converter = new showdown.Converter();
return converter.makeHtml(text);

Then in the template:

{{{markdown description}}}

I have done “meteor add showdown” and it says it has added it and showdown.

markdown added, version 1.0.8
showdown added, version 1.0.7

but in chrome I get this:
“Exception in template helper: ReferenceError: showdown is not defined
at Object. (http://localhost:3000/app/app.js?....yada yada etc”

Can anyone advise what I might need to do to fix it? I have been trying for ages and refreshed my browser + done a meteor reset. Nothing works…



You can add meteor add markdown and use it in your templates like:

### Header
I am using __markdown__.


Also take a look at the example in my app:

Exception in template helper: ReferenceError: showdown is not defined
at Object. (http://localhost:3000/app/app.js?hash=586ea1ff8e977728f643fe4327ff07a1986029fa:3205:25)
meteor.js?hash=199010c…:913 Exception from Tracker recompute function:
meteor.js?hash=199010c…:913 Error: Expected template or null, found: undefined
at ._render (spacebars.js?hash=6b2a9ad…:51)
at doRender (blaze.js?hash=38069f4…:2017)
at blaze.js?hash=38069f4…:1865
at Function.Template._withTemplateInstanceFunc (blaze.js?hash=38069f4…:3677)
at blaze.js?hash=38069f4…:1863
at Object.Blaze._withCurrentView (blaze.js?hash=38069f4…:2204)
at viewAutorun (blaze.js?hash=38069f4…:1862)
at Tracker.Computation._compute (tracker.js?hash=b267c37…:341)
at new Tracker.Computation (tracker.js?hash=b267c37…:229)
at Object.Tracker.autorun (tracker.js?hash=b267c37…:580)

If you add the package that @juliancwirko suggests, you don’t need to register the helper. I had this same problem because I had registered the helper earlier, forgot about it, and then tried adding the package and using it. Make sure to remove that helper.

1 Like

I fixed it, phew! I had to remove the helper declaration and use the #markdown + /markdown tags. The plural sight course is slightly out of date I guess… thanks for pointing me in the right direction :slight_smile:

Our messages crossed, thanks to both.