Skip to content

Commit

Permalink
feat(支持同步块格式的目录识别): 修复额外的多余目录识别问题
Browse files Browse the repository at this point in the history
  • Loading branch information
qixing-jk committed Dec 4, 2024
1 parent 079515a commit c2d8ed2
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions lib/notion/getPageTableOfContents.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const getPageTableOfContents = (page, recordMap) => {
/**
* 重写获取目录方法
*/
function getBlockHeader(contents, recordMap, toc, mustToc = false) {
function getBlockHeader(contents, recordMap, toc) {
if (!toc) {
toc = []
}
Expand Down Expand Up @@ -90,15 +90,8 @@ function getBlockHeader(contents, recordMap, toc, mustToc = false) {
)
} else if (type === 'transclusion_container') {
if (block.content?.length > 0) {
getBlockHeader(block.content, recordMap, toc, true)
getBlockHeader(block.content, recordMap, toc)
}
} else if (mustToc) {
toc.push({
id: blockId,
type,
text: getTextContent(block.properties?.title),
indentLevel: indentLevels[type]
})
}
}
}
Expand Down

0 comments on commit c2d8ed2

Please sign in to comment.