Slugify a URL, path or heading the same way that GitHub formats heading anchors.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.editorconfig
.eslintrc.json
.gitattributes
.gitignore
.travis.yml
.verb.md
LICENSE
README.md
index.js
package.json
test.js

README.md

helper-slugify NPM version NPM downloads Build Status

Slugify a URL, path or heading id using the same format as GitHub heading anchors.

Usage

var slugify = require('helper-slugify');

Lo-Dash usage

Usage with lodash:

var template = require('lodash.template');
var options = {imports: {slugify: require('helper-slugify')}};

var str = template('<%= slugify("foo bar baz") %>', options)();
console.log(str);
//=> 'foo-bar-baz'

Engine usage

Usage with engine:

var Engine = require('engine');
var engine = new Engine();

engine.helper('slugify', require('helper-slugify'));

engine.render('<%= slugify("foo bar baz") %>');
console.log(str);
//=> 'foo-bar-baz'

About

Related projects

Contributing

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

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb, v0.9.0, on July 19, 2016.