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

Skip to content

Commit e85d299

Browse files
committed
Add traversal option
1 parent ca9761d commit e85d299

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

www/src/templates/template-docs-markdown.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const useActiveHash = itemIds => {
5151
return activeHash
5252
}
5353

54-
const getHeadingIds = toc => {
54+
const getHeadingIds = (toc, traverseFullDepth = false) => {
5555
if (!toc) return []
5656

5757
const idList = []
@@ -61,8 +61,8 @@ const getHeadingIds = toc => {
6161
for (const item of toc) {
6262
idList.push(hashToId(item.url))
6363

64-
if (`items` in item) {
65-
idList.push(...getHeadingIds(item.items))
64+
if (`items` in item && traverseFullDepth) {
65+
idList.push(...getHeadingIds(item.items, true))
6666
}
6767
}
6868

0 commit comments

Comments
 (0)