0.0.1 • Published 3 years ago
markdown-headers v0.0.1
Markdown Headers
Parse markdown document's yaml headers.
install
npm install markdown-headers
Usage
full example
const {parseMarkdownHeaders} = require('markdown-headers');
// test example
const document = `
---
title: 'this is a title'
description: 'this is a description'
tags:
- hello world
- markdown parse
votes: 10000
show_cover: true
---
This is markdown content.
# title
## subtitle
- [ ] check
`
// usage
const result = parseMarkdownHeaders(document);
output
{
headers: {
title: 'this is a title',
description: 'this is a description',
tags: [ 'hello world', 'markdown parse' ],
votes: 10000,
show_cover: true
},
markdown: 'This is markdown content.\n\n# title\n\n## subtitle\n\n- [ ] check'
}