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.
- Host: GitHub
- URL: https://github.com/jonschlinkert/markdown-slug
- Owner: jonschlinkert
- License: mit
- Created: 2017-02-20T02:44:48.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-20T02:52:40.000Z (about 8 years ago)
- Last Synced: 2024-10-03T19:43:17.542Z (7 months ago)
- Topics: heading, link, markdown, slug, slugify, url
- Language: JavaScript
- Size: 7.81 KB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/contributing.md
- License: LICENSE
Awesome Lists containing this project
README
# markdown-slug [](https://www.npmjs.com/package/markdown-slug) [](https://npmjs.org/package/markdown-slug) [](https://npmjs.org/package/markdown-slug) [](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._