@@ -62,22 +62,16 @@ export default {
62
62
}
63
63
}
64
64
65
- function markActiveItemRecursive (item , currentAnchor , depth = 0 ) {
65
+ function markActiveItemRecursive (item , currentAnchor ) {
66
66
const selfActive = isActive (currentAnchor, item .path )
67
67
let active = selfActive
68
- if (item .type === ' auto ' ) {
68
+ if (item .children ) {
69
69
let childActive = false
70
70
for (const c of item .children ) {
71
- c .path = item .basePath + ' #' + c .slug
72
- if (markActiveItemRecursive (c, currentAnchor, depth + 1 )) {
73
- childActive = true
71
+ if (! c .path ) {
72
+ c .path = item .path .replace (hashRE, ' ' ) + ' #' + c .slug
74
73
}
75
- }
76
- active = selfActive || childActive
77
- } else if (item .type === ' group' ) {
78
- let childActive = false
79
- for (const c of item .children ) {
80
- if (markActiveItemRecursive (c, currentAnchor, depth + 1 )) {
74
+ if (markActiveItemRecursive (c, currentAnchor)) {
81
75
childActive = true
82
76
}
83
77
}
@@ -87,7 +81,7 @@ function markActiveItemRecursive (item, currentAnchor, depth = 0) {
87
81
const children = groupHeaders (item .headers )
88
82
for (const c of children) {
89
83
c .path = item .path + ' #' + c .slug
90
- if (markActiveItemRecursive (c, currentAnchor, depth + 1 )) {
84
+ if (markActiveItemRecursive (c, currentAnchor)) {
91
85
childActive = true
92
86
}
93
87
}
0 commit comments