Utility to parse variables at the top of a markdown file.
npm install md-vars
import parse from 'md-vars'
const markdown = `
---
title: "Hello"
"subtitle": "World",
spaces: 1
---
* A
* B
* C
`
// Will extract the variables from the top of the file as JSONish.
parse(markdown) /*
{
title: 'Hello',
subtitle: 'World',
spaces: 1,
text: '* A\n* B\n* C'
}
*/
- Use
npm test
to run tests.
Please feel free to create a PR!