Plugin to process front matter container for markdown-it parser
Plugin for processing front matter for markdown-it markdown parser.
$ npm install markdown-it-front-matter --save
Essentially, valid front matter is a fenced block:
---
---
valid-front-matter: true
---
The example above uses YAML but YAML is not required
(bring your own front matter parser)
const md = require('markdown-it')()
.use(require('markdown-it-front-matter'), function(fm) {
console.log(fm)
});
let result = md.render('---\ntitle: This is the Title\n---\n# Heading\n----\nsome text');
// > title: This is the Title
Code heavily borrowed from markdown-it-container
markdown-it-front-matter is distributed under the MIT License - see the LICENSE file for details.