mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
If we want to change markdown implementations in the future, we’ll bump the major version of the package.
16 lines
545 B
JavaScript
16 lines
545 B
JavaScript
if (Package.templating) {
|
|
var Template = Package.templating.Template;
|
|
var Blaze = Package.blaze.Blaze; // implied by `templating`
|
|
var HTML = Package.htmljs.HTML; // implied by `blaze`
|
|
|
|
Blaze.Template.registerHelper("markdown", new Template('markdown', function () {
|
|
var view = this;
|
|
var content = '';
|
|
if (view.templateContentBlock) {
|
|
content = Blaze._toText(view.templateContentBlock, HTML.TEXTMODE.STRING);
|
|
}
|
|
var converter = new Showdown.converter();
|
|
return HTML.Raw(converter.makeHtml(content));
|
|
}));
|
|
}
|