parent
7479c1045c
commit
764b55045d
@ -89,12 +89,18 @@ export function create(str = '', options = {}) {
|
||||
if (!options.isHome) {
|
||||
const tocsMenus = getTocsTitleNode([...tocsData]);
|
||||
node.children = addTocsInWarp([...tocsData], getTocsTitleNodeWarpper(tocsMenus));
|
||||
tocsMenus.forEach((menu) => {
|
||||
detailData.sections.push({
|
||||
a: menu?.properties?.href,
|
||||
t: getCodeString(menu.children),
|
||||
l: menu?.properties['data-num'],
|
||||
});
|
||||
tocsMenus.forEach((menu, idx) => {
|
||||
const level = menu?.properties['data-num'];
|
||||
if (idx + 1 === tocsMenus.length && level === 2) {
|
||||
return;
|
||||
}
|
||||
if (level < 4) {
|
||||
detailData.sections.push({
|
||||
a: menu?.properties?.href,
|
||||
t: getCodeString(menu.children),
|
||||
l: menu?.properties['data-num'],
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
node.children = tocsData;
|
||||
|
@ -45,7 +45,9 @@ export async function createHTML(files = [], num = 0) {
|
||||
searchData[options.filename] = data;
|
||||
searchData.name = options.filename;
|
||||
await fs.writeJSON(SEARCH_DATA_CACHE, searchData);
|
||||
const resultSearchData = Object.keys({ ...searchData }).map((name) => searchData[name]);
|
||||
const resultSearchData = Object.keys({ ...searchData })
|
||||
.map((name) => searchData[name])
|
||||
.filter((item) => typeof item !== 'string');
|
||||
await fs.writeJSON(SEARCH_DATA, resultSearchData);
|
||||
}
|
||||
await fs.writeFile(outputHTMLPath, html);
|
||||
|
Loading…
x
Reference in New Issue
Block a user