0.0.3 • Published 10 years ago
frontmatter v0.0.3
frontmatter 
A simple YAML frontmatter parser.
Installation
$ npm install frontmatterUsage
To parse the YAML frontmatter from a string:
var frontmatter = require('frontmatter');
var parsed = frontmatter(content);As in Jekyll, the YAML frontmatter should be delimited with triple-dash lines and defined at the beginning. For example:
---
title: Welcome
---
Hello!In this case, the parsed object would be:
{
"data": {
"title": "Welcome"
},
"content": "Hello!"
}For untrusted source, the safeLoad option should be used:
frontmatter(content, { safeLoad: true });Tests
$ npm install
$ npm testLicense
MIT