QUESTION: Using helper-markdown with gulp-hb
caraya opened this issue · comments
Carlos Araya commented
I am having a problem trying to use front-matter and layouts when building content using gulp-hb (version 8). The goal is to use a different layout based on whether the content is html versus Markdown.
I have the following question:
How can I convert Markdown to HTML in the process? I've tried using helper-markdown but it's not recognized as a helper and doesn't appear when I use debug
I'm using the following task
gulp.task('prepHB', () => {
return gulp.src('src/pages/**/*.{md,html}')
.pipe(frontMatter({
property: 'frontMatter',
remove: true,
}))
.pipe(hb({debug: true})
.partials('src/partials/components/**/*.hbs')
.helpers(require('helper-markdown'))
.helpers(require('handlebars-layouts'))
)
.pipe(extReplace('.html'))
.pipe(gulp.dest('docs/'));
});
Shannon Moeller commented
Not all handlebars plugins are compatible with the .helpers()
function out of the box. Try this:
.helpers({ markdown: require('helper-markdown') })
Shannon Moeller commented
@caraya Did you get it working?
Carlos Araya commented
Yes, I did