Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including maren-build with all npm packages installed. Try it out:

var marenBuild = require("maren-build")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

maren-build v0.2.0

build maren blog to _build directory

Maren Build

API

const {
  build,
  buildFile,
  buildFilePath
} = require('maren-build');

build

/**
 * Build blog in <cwd> and put files in <cwd>/_build
 *
 * @param cwd - Absolute path to the blog
 *
 * @param rawTheme - Theme that will have its styles and scripts hashed
 * @param rawTheme.name - Theme name (ie. "brown")
 * @param rawTheme.location - Absolute path to the theme
 * @param rawTheme.template - (data) => html
 * @param rawTheme.options
 * @param rawTheme.options.styles - ['brown-styles.min.css']
 * @param rawTheme.options.scripts - ['brown-scripts.min.js']
 *
 * @param renderFunction - (markdownString, theme) => html;
 *
 * @return { theme, pathsToWatch }
 * @return theme - Same as rawTheme with styles and scripts being hashed
 * @return theme.name
 * @return theme.location
 * @return theme.template
 * @return theme.options
 * @return theme.options.styles - ['/themes/brown/brown-styles-8a1...5ee.css']
 * @return theme.options.scripts - ['/themes/brown/brown-scripts-3c2...82a.js']
 * @return pathsToWatch - Glob paths to md files in "documents" and "draft"
 */
const {
  theme,
  pathsToWatch
} = await build(cwd, rawTheme, renderFunction);

buildFile

/**
 * Read Markdown file at "src",
 * use "theme" and "renderFunction" to render it to html,
 * and save html to "dest".
 */
const success = await buildFile(src, dest, theme, renderFunction);

buildFilePath

/**
 * Return absolute html path.
 */
const dest = buildFilePath(cwd, mdPath);

Tests

npm test

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free