Skip to content

Instantly share code, notes, and snippets.

@lionelB
Last active January 19, 2016 13:52
Show Gist options
  • Save lionelB/90d46a47efe3ecec42bf to your computer and use it in GitHub Desktop.
Save lionelB/90d46a47efe3ecec42bf to your computer and use it in GitHub Desktop.
markdown + gray-matter file transformation
var markdownit = require("markdown-it")("commonmark");
var yamlParser = require("gray-matter");
var fs = require("fs");
var path = require("path");
var content = fs.readFileSync(path.join(__dirname, "md/index.md"));
var yaml = yamlParser(content.toString());
console.log(markdownit.render(yaml.content));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment