Socket
Socket
Sign inDemoInstall

assemble-yaml

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assemble-yaml

Utility library for working with YAML front matter. Works with or without Assemble.


Version published
Weekly downloads
347
decreased by-15.57%
Maintainers
2
Weekly downloads
 
Created
Source

assemble-yaml NPM version Build Status

Utility library for working with YAML front matter. Works with or without Assemble.

Visit Assemble's documentation for many more examples and pointers on getting started.

Getting Started

npm install assemble-yaml --save

and use it as follows:

var yfm = require('assemble-yaml');

Methods

extract

Extract YAML front matter and content from files.

var raw = yfm.extract("./file.hbs", opts);

Parameters:

  • String: The file to read.
  • Object: The options object to pass to js-yaml

Returns:

Object with three properties

{
 "context": {}         // Object. YAML front matter returned as a JSON object.
 "content": ""         // String. File content, stripped of YAML front matter
 "originalContent": "" // String. Both content and YAML front matter.
}
context

Return YAML front matter as a JSON object.

var data = yfm.extract("./file.hbs").context;

Alias:

var data = yfm.extractJSON("./file.hbs");
content

Return the content of a file, with YAML front matter removed.

var content = yfm.extract("./file.hbs").content;

Alias:

var data = yfm.stripYFM("./file.hbs");

Release History

  • 2013-09-27   v0.1.3   Adds extractJSON and stripYFM convenience methods. Add regex to strip extraneous newlines left over after YFM is removed from a file.
  • 2013-09-22   v0.1.2   Adds grunt-readme and grunt-pkg-sync
  • 2013-08-11   v0.1.0   Initial setup - Migrated from main Assemble repo

Author

License

Copyright (c) 2013 Brian Woodward, contributors. Released under the MIT license


This file was generated on Mon Sep 02 2013 09:44:51.

Keywords

FAQs

Package last updated on 01 Nov 2013

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