An open API service indexing awesome lists of open source software.

https://github.com/jonschlinkert/markdown-slug

Slugify the url part of a markdown heading link.
https://github.com/jonschlinkert/markdown-slug

heading link markdown slug slugify url

Last synced: about 1 month ago
JSON representation

Slugify the url part of a markdown heading link.

Awesome Lists containing this project

README

        

# markdown-slug [![NPM version](https://img.shields.io/npm/v/markdown-slug.svg?style=flat)](https://www.npmjs.com/package/markdown-slug) [![NPM monthly downloads](https://img.shields.io/npm/dm/markdown-slug.svg?style=flat)](https://npmjs.org/package/markdown-slug) [![NPM total downloads](https://img.shields.io/npm/dt/markdown-slug.svg?style=flat)](https://npmjs.org/package/markdown-slug) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/markdown-slug.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/markdown-slug)

> Slugify the url part of a markdown heading link.

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install --save markdown-slug
```

## Usage

```js
var slugify = require('markdown-slug');

// forward slashes
console.log(slugify('Some/Article'));
//=> 'somearticle'

// backticks
console.log(slugify('Some`Article`'));
//=> 'somearticle'

// CJK punctuations
console.log(slugify('存在,【中文】;《标点》、符号!的标题?'));
//=> '%E5%AD%98%E5%9C%A8%E4%B8%AD%E6%96%87%E6%A0%87%E7%82%B9%E7%AC%A6%E5%8F%B7%E7%9A%84%E6%A0%87%E9%A2%98'

// &
console.log(slugify('Foo & Bar'));
//=> 'foo--bar'
```

## About

### Related projects

* [markdown-toc](https://www.npmjs.com/package/markdown-toc): Generate a markdown TOC (table of contents) with Remarkable. | [homepage](https://github.com/jonschlinkert/markdown-toc "Generate a markdown TOC (table of contents) with Remarkable.")
* [remarkable](https://www.npmjs.com/package/remarkable): Markdown parser, done right. 100% Commonmark support, extensions, syntax plugins, high speed - all in… [more](https://github.com/jonschlinkert/remarkable) | [homepage](https://github.com/jonschlinkert/remarkable "Markdown parser, done right. 100% Commonmark support, extensions, syntax plugins, high speed - all in one.")

### Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.

### Building docs

_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_

To generate the readme, run the following command:

```sh
$ 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:

```sh
$ npm install && npm test
```

### Author

**Jon Schlinkert**

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)

### License

Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
MIT

***

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.2, on February 19, 2017._