From f5ca32b8279925b4c62314468932fa8a4cfa5906 Mon Sep 17 00:00:00 2001 From: Benny Neugebauer Date: Wed, 4 May 2022 01:39:44 +0200 Subject: [PATCH 1/2] Add option to use slugize --- lib/slugify.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/slugify.js b/lib/slugify.js index 9fcbf40..a1376d6 100644 --- a/lib/slugify.js +++ b/lib/slugify.js @@ -2,6 +2,9 @@ exports.load = function (name) { var slugify; if (name && typeof name === 'string') { switch (name) { + case 'slugize': + slugify = require('hexo-util').slugize; + break; case 'transliteration': slugify = require('transliteration').slugify; break; From 9b356426129e37fccca21586f2c0310aaaf21adc Mon Sep 17 00:00:00 2001 From: Benny Neugebauer Date: Wed, 4 May 2022 01:41:10 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7b01a85..963bd87 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ toc: - `maxdepth`: Use headings whose depth is at most maxdepth. - `class`: The CSS Class for the toc. (*Default is `false`*) -- `slugify`: Choose which slugify function you want to use. Currently support [uslug](https://github.com/jeremys/uslug) (*Default*) and [transliteration](https://github.com/andyhu/node-transliteration). +- `slugify`: Choose which slugify function you want to use. Currently supported are [uslug](https://github.com/jeremys/uslug) (*Default*), [transliteration](https://github.com/andyhu/node-transliteration) and [slugize](https://github.com/hexojs/hexo-util#slugizestr-options). - `decodeEntities`: Select whether to enable decode entities. ( *Default is `false`* and please see [#15](https://github.com/bubkoo/hexo-toc/pull/15)). - `anchor`: Whether should have an anchor for each headings. (*Default is `false`*) - `position`: Where should the anchor be, `before` the title, or `after` the title. (*Default is `after`*);