Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

marked-metadata

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

marked-metadata

Markdwon parser with metadata support

  • 0.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

marked-metadata

Build Status

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:

---
layout: post
title: hello world
---

With marked-metadata you can parse any header metadata, using the defineTokens method:

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();

You can crop a markdown file by a given identifier:

var md2 = new MarkedMetaData('./test/test.md');
md2.defineTokens('<!--', '-->');
md2.markdown({ crop : '{{more}}'});

Contribute

Fork > Pull-request

Tests

npm test

Keywords

FAQs

Package last updated on 06 Jun 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc