Skip to content

Commit

Permalink
fix: 🔧 修复自动生成目录失败的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
viarotel committed Sep 19, 2023
1 parent 26634bb commit ab8e1c9
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions vitepress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,25 @@ import { generateSidebar } from 'vitepress-sidebar'
import dayjs from 'dayjs'
import { appName } from './src/configs/index.js'

const sidebar = generateSidebar({
documentRootPath: '/src/notes',
useTitleFromFileHeading: true,
collapsed: false,
includeRootIndexFile: false,
capitalizeFirst: true,
})[0]?.items || []
const sidebar
= generateSidebar({
documentRootPath: 'src/notes/',
useTitleFromFileHeading: true,
collapsed: false,
includeRootIndexFile: false,
capitalizeFirst: true,
}) || []

// console.log('sidebar', JSON.stringify(sidebar))

const memo = (() => {
const value = (
sidebar.find(item => item.text === 'Memo')?.items || []
).filter(item => item.text !== 'Index.md')
// @ts-expect-error
const items = sidebar.find(item => item.text === 'Memo')?.items || []
const value = items.filter(item => item.text !== 'Index.md')
return value
})()
// console.log('notes', JSON.stringify(notes))

// console.log('memo', JSON.stringify(memo))

function useImgTag(src) {
return `<img src="${src}" style="width: 20px; height: 20px;" class="hover:opacity-100 opacity-70 duration-500" />`
Expand Down

0 comments on commit ab8e1c9

Please sign in to comment.