Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config/charmap.json
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,12 @@
"ỷ": "y",
"Ỹ": "Y",
"ỹ": "y",
"‐": "-",
"‑": "-",
"‒": "-",
"–": "-",
"—": "-",
"―": "-",
"‘": "'",
"’": "'",
"“": "\\\"",
Expand Down
2 changes: 1 addition & 1 deletion slugify.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions test/slugify.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ describe('slugify', () => {
t.equal(slugify('foo bar--baz'), 'foo-bar-baz')
})

it('replace unicode dashes', () => {
t.equal(slugify('foo‐bar'), 'foo-bar') // U+2010 hyphen
t.equal(slugify('foo‑bar'), 'foo-bar') // U+2011 non-breaking hyphen
t.equal(slugify('foo‒bar'), 'foo-bar') // U+2012 figure dash
t.equal(slugify('foo–bar'), 'foo-bar') // U+2013 en dash
t.equal(slugify('foo—bar'), 'foo-bar') // U+2014 em dash
t.equal(slugify('foo―bar'), 'foo-bar') // U+2015 horizontal bar
t.equal(slugify('rock — paper'), 'rock-paper')
})

it('leave allowed chars', () => {
var allowed = ['*', '+', '~', '.', '(', ')', '\'', '"', '!', ':', '@']
allowed.forEach((symbol) => {
Expand Down