Socket
Socket
Sign inDemoInstall

frontmatter

Package Overview
Dependencies
4
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    frontmatter

Parsing YAML frontmatter from a string.


Version published
Weekly downloads
2.9K
increased by67.15%
Maintainers
1
Install size
744 kB
Created
Weekly downloads
 

Readme

Source

frontmatter Build Status

A simple YAML frontmatter parser.

Installation

$ npm install frontmatter

Usage

To parse the YAML frontmatter from a string:

var frontmatter = require('frontmatter');
var parsed = frontmatter(content);

As in Jekyll, the YAML frontmatter should be delimited with triple-dash lines and defined at the beginning. For example:

---
title: Welcome
---

Hello!

In this case, the parsed object would be:

{
  "data": {
    "title": "Welcome"
  },
  "content": "Hello!"
}

For untrusted source, the safeLoad option should be used:

frontmatter(content, { safeLoad: true });

Tests

$ npm install
$ npm test

License

MIT

Keywords

FAQs

Last updated on 30 Jan 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc