diff --git a/README.md b/README.md index 09aca48..3b30881 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ The `opts` object can contain: Name | Description | Default ------------------|----------------------------------------------------------------|----------------------------------- `level` | Minimum level to apply anchors on or array of selected levels. | 1 -`slugify` | A custom slugification function. | [string.js' `slugify`][slugify] +`slugify` | A custom slugification function. | [`slugify`][slugify] `permalink` | Whether to add permalinks next to titles. | `false` `renderPermalink` | A custom permalink rendering function. | See [`index.js`](index.js) `permalinkClass` | The class of the permalink anchor. | `header-anchor` @@ -28,7 +28,7 @@ Name | Description `permalinkHref` | A custom permalink `href` rendering function. | See [`index.js`](index.js) `callback` | Called with token and info after rendering. | `undefined` -[slugify]: http://stringjs.com/#methods/slugify +[slugify]: https://www.npmjs.com/package/slugify The `renderPermalink` function takes the slug, an options object with the above options, and then all the usual markdown-it rendering diff --git a/index.js b/index.js index d3d295e..223c805 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,6 @@ -const string = require('string') +const slugifier = require('slugify') -const slugify = s => - string(s).slugify().toString() +const slugify = s => slugifier(s, {lower: true}) const position = { false: 'push', diff --git a/package.json b/package.json index d9dbffc..1ea418f 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "test": "npm run lint && node test" }, "dependencies": { - "string": "^3.3.3" + "slugify": "^1.3.0" }, "devDependencies": { "markdown-it": "^8.3.0",