Skip to content

Commit 66f5c8e

Browse files
committed
feat: compatible with '/README' path
1 parent d7df608 commit 66f5c8e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/pagination.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,17 @@ function findChapter (element) {
3232
function findHyperlink (element) {
3333
return element.href ? element : query('a', element)
3434
}
35+
function normailizeLink (path) {
36+
if (path && path.toUpperCase() === '#/README') {
37+
return '#/'
38+
}
39+
return path
40+
}
3541
function isALinkTo (path, element) {
3642
if (arguments.length === 1) {
3743
return (element) => isALinkTo(path, element)
3844
}
39-
return decodeURIComponent(element.getAttribute('href').split('?')[0]) === decodeURIComponent(path)
45+
return normailizeLink(decodeURIComponent(element.getAttribute('href').split('?')[0])) === normailizeLink(decodeURIComponent(path))
4046
}
4147

4248

0 commit comments

Comments
 (0)