Node API Blueprint Parser
Switch branches/tags
Clone or download
Latest commit d6d5e1b Nov 20, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib feat(validation): Add support for validating an API Blueprint Oct 31, 2016
test feat: Update to Drafter 4.0.0-pre.2 Nov 20, 2018
.gitignore Initial package Jul 18, 2016
.travis.yml chore: Release 2.0.0-pre.0 Sep 12, 2018 chore: Release 2.0.0-pre.1 Nov 20, 2018
LICENSE Address PR feedback Jul 19, 2016 docs: Fixes #12 Jul 26, 2017
package.json chore: Release 2.0.0-pre.1 Nov 20, 2018


Drafter NPM Package Build Status

The Drafter NPM package is an API Blueprint parser for Node. This package is a wrapper around the underlying C++ parser Drafter. Drafter NPM optionally depends on the C++ binding to Drafter Protagonist. If for any reason Protagonist is not installable, this package will fallback to using the slower, pure JavaScript version of Drafter, drafter.js.


Drafter can be installed from NPM. If you want to use Drafter from a web browser, check out drafter.js.

$ npm install drafter


var drafter = require('drafter');

Once you've included drafter, you can parse an API Blueprint asynchronously:

var options = {
  generateSourceMap: true,

drafter.parse('# API Blueprint...', options, function(err, result) {
  if (err) {
  } else {

Alternatively, you can use Drafter synchronously:

try {
  var result = drafter.parseSync('# API Blueprint...', options);
} catch (err) {

Parsing Options

Options can be passed to the parser as an optional second argument to both the asynchronous and synchronous interfaces:

var options = {
  generateSourceMap: true

drafter.parse('# My API', options, callback);

The available options are:

Name Description
requireBlueprintName Require parsed blueprints have a title (default: false)
generateSourceMap Enable sourcemap generation (default: false)


MIT License. See the LICENSE file.