
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

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) {
console.log(err);
} else {
console.log(result);
}
});
Alternatively, you can use Drafter synchronously:
try {
var result = drafter.parseSync('# API Blueprint...', options);
console.log(result);
} catch (err) {
console.log(err);
}
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.
2.0.0 (2020-01-09)
This update now uses Protagonist 2.0.0. Please see Protagonist 2.0.0 for the list of changes.
This update now uses Drafter.js 3.0.0. Please see Drafter.js 3.0.0 for the list of changes.
FAQs
Node API Blueprint Parser
The npm package drafter receives a total of 7,745 weekly downloads. As such, drafter popularity was classified as popular.
We found that drafter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.

Product
Bringing supply chain security to the next generation of JavaScript package managers