JSPM

snapdragon-capture

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1354
  • Score
    100M100P100Q116597F
  • License MIT

Snapdragon plugin that adds a capture method to the parser instance.

Package Exports

  • snapdragon-capture

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (snapdragon-capture) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

snapdragon-capture NPM version NPM monthly downloads NPM total downloads Linux Build Status

Snapdragon plugin that adds a capture method to the parser instance.

Install

Install with npm:

$ npm install --save snapdragon-capture

Usage

Requires snapdragon v0.9.0 or higher.

var capture = require('snapdragon-capture');
var Snapdragon = require('snapdragon');
var snapdragon = new Snapdragon();
snapdragon.use(capture());

API

Example

var Snapdragon = require('snapdragon');
var capture = require('snapdragon-capture');
var parser = new Snapdragon.Parser();
parser.use(capture());

capture

Create a node of the given type using the specified regex or function.

Params

  • type {String}
  • regex {RegExp|Function}: Pass the regex to use for capturing. Pass a function if you need access to the parser instance.
  • returns {Object}: Returns the parser instance for chaining

Example

parser
  .capture('slash', /^\//)
  .capture('comma', /^,/)
  .capture('foo', function() {
    var pos = this.position();
    var match = this.match(/^\./);
    if (match) {
      return pos(this.node(match[0]));
    }
  });

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Please read the contributing guide for advice on opening issues, pull requests, and coding standards.

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. MIT


This file was generated by verb-generate-readme, v0.4.2, on February 08, 2017.