Explicitly helper use instead of implicitly converting from markdown
This commit is contained in:
@@ -34,7 +34,7 @@
|
|||||||
<h4 id="title">{{ title }}</h4>
|
<h4 id="title">{{ title }}</h4>
|
||||||
<p id="shortdesc">{{ shortdesc }}</p>
|
<p id="shortdesc">{{ shortdesc }}</p>
|
||||||
<div id="docs">
|
<div id="docs">
|
||||||
{{{ docs }}}
|
{{ md docs }}
|
||||||
</div>
|
</div>
|
||||||
<div id="tags">{{ tags }}</div>
|
<div id="tags">{{ tags }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
|
||||||
var Metalsmith = require('metalsmith');
|
var Metalsmith = require('metalsmith');
|
||||||
|
var handlebars = require('handlebars');
|
||||||
var templates = require('metalsmith-templates');
|
var templates = require('metalsmith-templates');
|
||||||
var marked = require('marked');
|
var marked = require('marked');
|
||||||
var pkg = require('../package.json');
|
var pkg = require('../package.json');
|
||||||
@@ -39,9 +40,6 @@ function augmentExamples(files, metalsmith, done) {
|
|||||||
throw new Error(filename + ': Missing template in YAML front-matter');
|
throw new Error(filename + ': Missing template in YAML front-matter');
|
||||||
}
|
}
|
||||||
var id = match[1];
|
var id = match[1];
|
||||||
if (file.docs) {
|
|
||||||
file.docs = marked(file.docs);
|
|
||||||
}
|
|
||||||
|
|
||||||
// add js tag and source
|
// add js tag and source
|
||||||
var jsFilename = id + '.js';
|
var jsFilename = id + '.js';
|
||||||
@@ -93,7 +91,12 @@ function main(callback) {
|
|||||||
.use(augmentExamples)
|
.use(augmentExamples)
|
||||||
.use(templates({
|
.use(templates({
|
||||||
engine: 'handlebars',
|
engine: 'handlebars',
|
||||||
directory: templatesDir
|
directory: templatesDir,
|
||||||
|
helpers: {
|
||||||
|
md: function(str) {
|
||||||
|
return new handlebars.SafeString(marked(str));
|
||||||
|
}
|
||||||
|
}
|
||||||
}))
|
}))
|
||||||
.build(function(err) {
|
.build(function(err) {
|
||||||
callback(err);
|
callback(err);
|
||||||
|
|||||||
Reference in New Issue
Block a user