Skip to content

Instantly share code, notes, and snippets.

@kartiknair
Created March 10, 2020 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kartiknair/512e83f345bd2cfc6634c077b12add15 to your computer and use it in GitHub Desktop.
Save kartiknair/512e83f345bd2cfc6634c077b12add15 to your computer and use it in GitHub Desktop.
const config = require("./config");
const fm = require("front-matter");
const marked = require("marked");
const createPost = postPath => {
const data = fs.readFileSync(`${config.dev.postsdir}/${postPath}.md`, "utf8");
const content = fm(data);
content.body = marked(content.body);
content.path = postPath;
return content;
};
module.exports = createPost;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment