Utility to parse variables at the top of a markdown file.
Installation
Npm
npm install md-vars
Example
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'
}
*/
Contributions
- Use
npm test
to run tests.
Please feel free to create a PR!