fix(slugify): GitHub compatible heading links, fixed #267

fix/351
qingwei.li 7 years ago
parent 0624e592d8
commit c195d2d1a6
  1. 3
      src/core/render/slugify.js

@ -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…
Cancel
Save