fix(slugify): GitHub compatible heading links, fixed #267
This commit is contained in:
parent
0624e592d8
commit
c195d2d1a6
1 changed files with 2 additions and 1 deletions
|
|
@ -4,8 +4,9 @@ const re = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,.\/:;<=>?@\[\]^`{|}~]/g
|
|||
export function slugify (str) {
|
||||
if (typeof str !== 'string') return ''
|
||||
|
||||
str = /^[\w\s]+$/g.test(str) ? str.toLowerCase() : str
|
||||
|
||||
let slug = str
|
||||
.toLowerCase()
|
||||
.trim()
|
||||
.replace(/<[^>\d]+>/g, '')
|
||||
.replace(re, '')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue