Closed EvansJahja closed 6 years ago
return gulp.src(globMarkdown)
.pipe(markdown(opts, (md=>{
md.renderer.rules.heading_open = headingAnchorRendererPlugin
})))
function headingAnchorRendererPlugin(tokens, idx ) {
if (tokens[idx+1].type == 'inline') {
let heading_anchor = slug(tokens[idx+1].content, {lower: true})
return '<h' + tokens[idx].hLevel + ' id="' + heading_anchor + '">';
}
return '<h' + tokens[idx].hLevel + '>';
}
@johnotander @charlike Any comments?
Sorry for the delay @Charon77. This lgtm, do you mind adding a bit of documentation to the readme? Then I'll get this merged and published.
@Charon77 friendly ping (:
Ah sorry, I must have missed the notif and didn't see the comments here.
I'll sure do, will keep you posted
@johno Is this alright?
This is great, thanks!
2nd parameter fnConfigureMd is expected to be a function that receives the Remarked instance.
Do whatever you want with md there synchronously