1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

fix toc by sharing slugify()

This commit is contained in:
Baptiste Augrain
2018-12-15 10:11:04 +01:00
parent 743c97940e
commit 4f9b37433c
3 changed files with 33 additions and 47 deletions

6
browser/lib/slugify.js Normal file
View File

@@ -0,0 +1,6 @@
module.exports = function slugify (title) {
return encodeURI(title.trim()
.replace(/[\]\[\!\"\#\$\%\&\'\(\)\*\+\,\.\/\:\;\<\=\>\?\@\\\^\_\{\|\}\~]/g, '')
.replace(/\s+/g, '-'))
.replace(/\-+$/, '')
}