Socket
Socket
Sign inDemoInstall

balrog-meta-htmlcomment

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    balrog-meta-htmlcomment

Extract metadata from files by looking at a leading comment!


Version published
Maintainers
1
Install size
5.20 kB
Created

Readme

Source

balrog-meta-htmlcomment

Build Status

Extract metadata from files by looking at a leading comment!

Example

Input:

<!--
  title: How to eat food
  author: @brianloveswords
  sandwich: grilled cheese & tomato
  tags: pizza, taco, burrito
  date: 2013-10-28
-->

# How to eat food
Step 1: eat it up
Step 2: awesome

Output:

{
  title: 'How to eat food',
  author: 'Brian J Brennan',
  sandwich: 'grilled cheese & tomato',
  tags: [ 'pizza', 'taco', 'burrito' ],
  date: '2013-10-28'
}

Install

TODO: talk about balrog integration

$ npm install balrog-meta-htmlcomment

Usage

TODO: talk about balrog usage

var extract = require('balrog-meta-htmlcomment')

extract(content)

content should be either a string or a buffer. If it is a buffer, it will be converted to a string with .toString('utf8').

It's expected that the first non-whitspace string in content is <!-- on its own line. Every line after that will be treated like a <key>:<value> pair. Any whitespace at the beginning and end of the line will be trimmed, as well as any whitespace before and after the “:”.

A “tags” key will be represented in the metadata as an array, using the comma character (and any leading/trailing whitespace) as the separator to split the string. So something like tags: hey, you, guys would be represented as ['hey', 'you', 'guys'].

License

Simplified BSD License

Keywords

FAQs

Last updated on 28 Oct 2013

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