解析 Hexo 格式的文章

817 阅读1分钟

Parse posts that are formated with Yaml and Markdown.

Installation

npm install --save readpost

Example

Meta is Yaml, Content is Markdown:

title: Hello World
categories:
  - life
  - random
---
Tomorrow is another **day**, oh uptown funk you up. 

Usage:

const readpost = require('readpost');
const post = fs.readFileSync('./post.md', 'utf8');
const data = readpost(post);
// output:
{
  meta: Object,
  content: String
}

License

MIT © EGOIST