Skip to content

Commit ad83169

Browse files
committed
fix: handle headers that start with numbers (fix #121)
1 parent 5f7e199 commit ad83169

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/markdown/slugify.js

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ module.exports = function slugify (str) {
1515
.replace(/\-{2,}/g, '-')
1616
// Remove prefixing and trailing separtors
1717
.replace(/^\-+|\-+$/g, '')
18+
// ensure it doesn't start with a number (#121)
19+
.replace(/^(\d)/, '_$1')
1820
// lowercase
1921
.toLowerCase()
2022
}

0 commit comments

Comments
 (0)