Add YAML metadata to the remarkable pluggable markdown parser
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.gitignore
.travis.yml
LICENSE
README.md
index.js
meta.js
package.json

README.md

remarkable-meta

Add YAML metadata to the remarkable pluggable markdown parser

build status

Based on code by Alex Kocharin from this mailing list post.

Installation

This module is installed via npm:

$ npm install remarkable-meta

Example Usage

Given the following markdown file test.md with YAML meta data delimited by --- placed at the very top of the markdown file:

---
My: Word
Author: Eugene
Stuff:
  - My
  - Stuff
---

# My document

## Second heading

This is awesome.

* a point
* another point

The YAML front-matter metadata will be available on the markdown object after parsing when you add the remarkable-meta plugin:

var meta = require('remarkable-meta');
var md = new Remarkable();
md.use(meta);

// Load the file listed above
var file = fs.readFileSync('./test.md', 'uf8');

var html = md.render(mdText);
console.log(md.meta);
// { My: 'Word', Author: 'Eugene', Stuff: [ 'My', 'Stuff' ] }