mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
feat(plugin-search): optimize search index logger (#676)
This commit is contained in:
parent
94e755c422
commit
22a5f10add
@ -147,14 +147,25 @@ ${page.contentRendered}`
|
||||
break
|
||||
const { anchor, text, titles } = section
|
||||
const id = anchor ? [fileId, anchor].join('#') : fileId
|
||||
const item = {
|
||||
id,
|
||||
text,
|
||||
title: titles.at(-1)!,
|
||||
titles: titles.slice(0, -1),
|
||||
|
||||
if (index.has(id)) {
|
||||
if (anchor) {
|
||||
logger.error(`${colors.green('[@vuepress-plume/plugin-search]')} duplicate heading anchor : ${colors.cyan(titles.join(' >> '))} \n at ${colors.cyan(fileId)}`)
|
||||
}
|
||||
else {
|
||||
logger.error(`${colors.green('[@vuepress-plume/plugin-search]')} duplicate page permalink : ${colors.cyan(fileId)}`)
|
||||
}
|
||||
}
|
||||
else {
|
||||
const item = {
|
||||
id,
|
||||
text,
|
||||
title: titles.at(-1)!,
|
||||
titles: titles.slice(0, -1),
|
||||
}
|
||||
index.add(item)
|
||||
cache.push(item)
|
||||
}
|
||||
index.add(item)
|
||||
cache.push(item)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user