diff --git a/bower.json b/bower.json index ef41c7d..ab12691 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "handlebars-helper-md", - "version": "0.1.7", + "version": "0.2.0", "main": [ "./index.js" ] diff --git a/index.js b/index.js index a0e3361..a9281fc 100644 --- a/index.js +++ b/index.js @@ -117,15 +117,21 @@ module.exports.register = function (Handlebars, options, params) { var fn = Handlebars.compile(template); var output = fn(ctx); - // Prepend any content in the given partial to the output + // Prepend or append any content in the given partial to the output var md = options.md || options.data.md || {}; var append = ''; - if(md.origin === true) { - append = Handlebars.compile(Handlebars.partials[md.source_template])(ctx, {data: data}); + var prepend = ''; + + if(md.prepend) { + prepend = Handlebars.compile(Handlebars.partials[md.prepend])(ctx, {data: data}); + } + if(md.append) { + append = Handlebars.compile(Handlebars.partials[md.append])(ctx, {data: data}); } return { data: data, + prepend: prepend, append: append, content: marked(output) }; @@ -133,7 +139,7 @@ module.exports.register = function (Handlebars, options, params) { if(options.debug) {file.writeDataSync(options.debug, obj);} // Return content from src files - return obj.content + obj.append; + return obj.prepend + obj.content + obj.append; }).join(options.sep); result += src; diff --git a/package.json b/package.json index 336e622..ceeb2d8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "handlebars-helper-md", "description": "Convert markdown to HTML. Use wildcard (glob) patterns for files. Like Assemble itself, this helper will automatically determine the correct context to use, or a context may be explicitly passed in as a second parameter.", - "version": "0.1.7", + "version": "0.2.0", "homepage": "https://github.com/helpers/handlebars-helper-md", "author": { "name": "Jon Schlinkert",