Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including snapdragon-capture with all npm packages installed. Try it out:

var snapdragonCapture = require("snapdragon-capture")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

snapdragon-capture v0.2.0

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

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 with npm:

$ npm install --save snapdragon-capture


Requires snapdragon v0.9.0 or higher.

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



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


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


  • 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


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


Related projects


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 is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the 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


Jon Schlinkert


Copyright © 2017, Jon Schlinkert. MIT

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

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free