Use blacklist for puctuators

Currently we can't use `/\p{L}/u` which would let use use a whitelist instead

Fixes #37079
This commit is contained in:
Matt Bierner
2018-05-25 11:56:41 -07:00
parent 281f242cff
commit 558c694d47
2 changed files with 19 additions and 1 deletions

View File

@@ -23,7 +23,7 @@ export const githubSlugifier: Slugifier = new class implements Slugifier {
heading.trim()
.toLowerCase()
.replace(/\s+/g, '-') // Replace whitespace with -
.replace(/[^\w\-]+/gu, '') // Remove non-word chars
.replace(/[\]\[\!\'\#\$\%\&\'\(\)\*\+\,\.\/\:\;\<\=\>\?\@\\\^\_\{\|\}\~\`]/g, '') // Remove known puctuators
.replace(/^\-+/, '') // Remove leading -
.replace(/\-+$/, '') // Remove trailing -
);