JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 24
  • Score
    100M100P100Q59789F
  • License MIT

Markdwon parser with metadata support

Package Exports

  • marked-metadata

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (marked-metadata) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

marked-metadata

Markdown parser (using marked) with metadata header support.

Installing

npm install marked-metadata

Then, just require marked-metadata in your project:

var mkmeta = require('marked-metadata');

How to use

marked-metadata was built on top of the awesome marked.
But sometimes you need some meta information about the markdown file.
Normally a pattern like is used to define a header metadata:

<!--
layout: post
title: hello world
-->

Or something like this pattern:
```text

layout: post title: hello world


With marked-metadata you can parse any header metadata, using the defineTokens method:  
```javascript
var md = new MarkedMetaData('./test/test.md');
md.defineTokens('<!--', '-->');

You can get just the markdown metadata:

var md = new MarkedMetaData('./test/test.md');
md.defineTokens('<!--', '-->');
var meta = md.metadata();

And you can get just the markdown content (without the header)

var md = new MarkedMetaData('./test/test.md');
md.defineTokens('<!--', '-->');
var content = md.markdown();

Contribute

Fork > Pull-request

Tests

npm test