diff --git a/config/examples/example.html b/config/examples/example.html index 0545a59a86..ea80d279f0 100644 --- a/config/examples/example.html +++ b/config/examples/example.html @@ -34,7 +34,7 @@

{{ title }}

{{ shortdesc }}

- {{{ docs }}} + {{ md docs }}
{{ tags }}
diff --git a/tasks/build-examples.js b/tasks/build-examples.js index f8aac93f34..789fa3f6fb 100644 --- a/tasks/build-examples.js +++ b/tasks/build-examples.js @@ -1,6 +1,7 @@ var path = require('path'); var Metalsmith = require('metalsmith'); +var handlebars = require('handlebars'); var templates = require('metalsmith-templates'); var marked = require('marked'); var pkg = require('../package.json'); @@ -39,9 +40,6 @@ function augmentExamples(files, metalsmith, done) { throw new Error(filename + ': Missing template in YAML front-matter'); } var id = match[1]; - if (file.docs) { - file.docs = marked(file.docs); - } // add js tag and source var jsFilename = id + '.js'; @@ -93,7 +91,12 @@ function main(callback) { .use(augmentExamples) .use(templates({ engine: 'handlebars', - directory: templatesDir + directory: templatesDir, + helpers: { + md: function(str) { + return new handlebars.SafeString(marked(str)); + } + } })) .build(function(err) { callback(err);