md-vars

1.0.1 • Public • Published

MD Vars
API stability Standard NPM version Downloads

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!

Package Sidebar

Install

npm i md-vars

Weekly Downloads

2

Version

1.0.1

License

MIT

Last publish

Collaborators

  • dylanpiercey