New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

metalsmith-comment-yaml

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metalsmith-comment-yaml

Extract data from YAML in javascript comments.

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
334
increased by14.78%
Maintainers
1
Weekly downloads
 
Created
Source

metalsmith-comment-yaml

Metalsmith plugin to extract data from YAML in javascript comments.

Uses the esprima parser to scan all javascript BLOCK comments for YAML.

Each block of YAML will be added to a list and set on your global metadata.

This can be used, for example, to easily generate documentation from structured YAML in javascript block comments.

Usage

Install
npm install metalsmith-comment-yaml
API
var commentYaml = require('metalsmith-comment-yaml');
metalsmith.use(commentYaml({
  "globalMetadataVariableName" : "path/to/javascript.js"
}));
CLI (metalsmith.json)
{
  "plugins" : {
    "metalsmith-comment-yaml" : {
      "globalMetadataVariableName" : "path/to/javascript.js"
    }
  }
}

Example

library.js

// All line comments are ignored

/*
  Also, this block comment is ignored because it doesn't start with the YAML "---"
*/

/*
  ---
  methodName  : methodOne
  description : Simple function
  arguments   :
    - argumentName : str
*/
function methodOne(str){
  return "hello, " + str;
}

docs.jade
for doc in documentation
  h1 #{doc.methodName}
  p.description #{doc.description}

  h3 Arguments
  ul
    for arg in doc.arguments
      li #{arg.argumentName}
metalsmith.json
{
  "plugins" : {
    "metalsmith-comment-yaml" : {
      "documentation" : "library.js"
    }
    , ...
  }
}

License

Apache-2.0

Keywords

FAQs

Package last updated on 30 Oct 2015

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