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

frontmatter

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

frontmatter

Parsing YAML frontmatter from a string.

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
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

Package last updated on 30 Jan 2016

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