Explicitly helper use instead of implicitly converting from markdown

This commit is contained in:
Tim Schaub
2015-04-06 10:58:00 -06:00
parent 3b96071096
commit 121a83f19e
2 changed files with 8 additions and 5 deletions

View File

@@ -34,7 +34,7 @@
<h4 id="title">{{ title }}</h4>
<p id="shortdesc">{{ shortdesc }}</p>
<div id="docs">
{{{ docs }}}
{{ md docs }}
</div>
<div id="tags">{{ tags }}</div>
</div>

View File

@@ -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);