Skip to content

Commit

Permalink
fix(slugify): GitHub compatible heading links, fixed #267
Browse files Browse the repository at this point in the history
  • Loading branch information
QingWei-Li committed Oct 2, 2017
1 parent 0624e59 commit c195d2d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/render/slugify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, '')
Expand Down

0 comments on commit c195d2d

Please sign in to comment.