Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Markdown rendering with JSON frontmatter
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
README.md
index.js
package.json

README.md

mdrender

Render a markdown file with optional JSON frontmatter.

Example

Rendering this file (file.md):

{{{
  "layout": "article",
  "tags": ["some", "nice", "tags"]
}}}

# My Article

It's great.

Use mdrender, passing the path and a callback.

var mdrender = require('mdrender');

mdrender('/path/to/file.md', function (err, data) {
  . . .
});

Data looks like:

{
  title: "My Article",
  layout: "article",
  attributes: {
    tags: ["some", "nice", "tags"]
  },
  html: "<h1>My Article</h1>\n<p>It's great.</p>",
  markdown: "# My Article\n\nIt's great."
}

Install

npm install mdrender

License

MIT

Something went wrong with that request. Please try again.