From 2ba25c94c7a58a8b26163f2865351dd2253d6c8c Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Fri, 15 Mar 2024 00:39:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(plugin-notes-data):=20=E4=BE=A7=E8=BE=B9?= =?UTF-8?q?=E6=A0=8F=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90=20=20#57?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/plugin-notes-data/src/node/prepareNotesData.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/plugin-notes-data/src/node/prepareNotesData.ts b/plugins/plugin-notes-data/src/node/prepareNotesData.ts index e335b881..bba2491b 100644 --- a/plugins/plugin-notes-data/src/node/prepareNotesData.ts +++ b/plugins/plugin-notes-data/src/node/prepareNotesData.ts @@ -37,7 +37,7 @@ function resolvedNotesData(app: App, options: NotesDataOptions, result: NotesDat const { include, exclude, notes, dir: _dir, link } = options if (!notes || notes.length === 0) return - const dir = normalizePath(_dir) + const dir = normalizePath(_dir).replace(/^\//, '') const filter = createFilter(ensureArray(include), ensureArray(exclude), { resolve: false, }) @@ -152,7 +152,7 @@ function initSidebarByAuto( let items = result // eslint-disable-next-line no-cond-assign while ((dir = paths[index])) { - const text = dir.replace(/\.md$/, '') + const text = dir.replace(/\.md$/, '').replace(/^\d+\./, '') let current = items.find(item => item.text === text) if (!current) { current = { text, link: undefined, items: [] }