transform-yaml-markdown v5.0.0
transform-yaml-markdown

transform a folder of markdown files with yaml frontmatter to html
Installation
npm i transform-yaml-markdownUsage
transform-yaml-markdown <source> <destination> [render] [postRender]The render and postRender functions should be exported as common.js functions.
render gets a data object passed with the meta data and raw markdown from the current file, a collection of all other files in the current directory and a collection of all files. It should return a Promise that fulfills with the rendered HTML.
example: render.js
module.exports = function(currentFile, filesInCurrentFolder, allFiles) {
return Promise.resolve(
'<code>'
+JSON.stringify(currentFile, null, 2)+' of '+allFiles.length
+'\n'
+JSON.stringify(filesInCurrentFolder, null, 2)
+'</code>'
);
};postRender receives a collection of rendered files including a renderedPath property and should also return a Promise that fulfills whenever your post render hook is done.
example: post-render.js
module.exports = function postRender(renderedFiles) {
console.log('number of rendered files: %i', renderedFiles.length);
return Promise.resolve(renderedFiles);
};By default the command tries to load render.js and post-render.js from the current working directory if not specified.
LICENSE
The MIT License (MIT) Maximilian Hoffmann