mirror of
https://github.com/zhigang1992/docsify.git
synced 2026-01-12 22:46:48 +08:00
fix(slugify): GitHub compatible heading links, fixed #267
This commit is contained in:
@@ -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, '')
|
||||
|
||||
Reference in New Issue
Block a user