Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1bb4a9a

Browse files
parthppep-parth
authored andcommitted
Replace apostrophe with empty string (like github)
Github treats apostrophe as empty string. Hence, slugger should do the same.
1 parent 9a212f0 commit 1bb4a9a

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = BananaSlug
44

55
var own = Object.hasOwnProperty
66
var whitespace = /\s/g
7-
var specials = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g
7+
var specials = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g
88

99
function BananaSlug () {
1010
var self = this

test/6-characters.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@
1313
# initial space
1414

1515
# final space
16+
17+
# heading with apostrophe’s

test/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ var testCases = [
102102
text: 'final space ',
103103
slug: 'final-space'
104104
},
105+
// Note: Apostrophe in heading is trimmed off in markdown
106+
{
107+
mesg: 'apostrophe’s should be trimmed',
108+
text: 'apostrophe’s should be trimmed',
109+
slug: 'apostrophes-should-be-trimmed'
110+
},
105111
// See `7-duplicates.md`
106112
{
107113
mesg: 'deals with duplicates correctly',

0 commit comments

Comments
 (0)