Socket
Book a DemoInstallSign in
Socket

transform-yaml-markdown

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

transform-yaml-markdown

transform a folder of markdown files with yaml frontmatter to html

latest
Source
npmnpm
Version
5.0.0
Version published
Maintainers
1
Created
Source

transform-yaml-markdown version build

transform a folder of markdown files with yaml frontmatter to html

Installation

npm i transform-yaml-markdown

Usage

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

Keywords

markdown

FAQs

Package last updated on 18 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts