From 693f70c62c17d1e649f68c44d7a4fc02f3e22883 Mon Sep 17 00:00:00 2001 From: HalfSweet <60973476+HalfSweet@users.noreply.github.com> Date: Tue, 6 Jun 2023 14:21:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E4=BE=A7=E8=BE=B9?= =?UTF-8?q?=E6=A0=8F=E6=8E=92=E5=BA=8F=E8=A7=84=E5=88=99=E5=87=BD=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E6=8C=89=E7=85=A7=E4=B8=AD=E6=96=87=E7=9A=84=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E6=96=B9=E5=BC=8F=E8=BF=9B=E8=A1=8C=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E5=8C=96=E6=8E=92=E5=BA=8F=20(#119)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vuepress/sidebarSorter.ts | 12 ++++++++++++ docs/.vuepress/theme.ts | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 docs/.vuepress/sidebarSorter.ts diff --git a/docs/.vuepress/sidebarSorter.ts b/docs/.vuepress/sidebarSorter.ts new file mode 100644 index 0000000..7d1c36a --- /dev/null +++ b/docs/.vuepress/sidebarSorter.ts @@ -0,0 +1,12 @@ +import { SidebarInfo } from "vuepress-theme-hope"; + +export const mySidebarTitleSorter = ( + infoA: SidebarInfo, + infoB: SidebarInfo +): number => { + const infoANFC = infoA.title.normalize('NFC'); + const infoBNFC = infoB.title.normalize('NFC'); + return infoANFC.localeCompare(infoBNFC, 'zh', { + numeric: true, + }) +}; \ No newline at end of file diff --git a/docs/.vuepress/theme.ts b/docs/.vuepress/theme.ts index abf007b..52e4634 100644 --- a/docs/.vuepress/theme.ts +++ b/docs/.vuepress/theme.ts @@ -1,6 +1,7 @@ import { hopeTheme } from "vuepress-theme-hope"; import navbar from "./navbar"; import sidebar from "./sidebar"; +import { mySidebarTitleSorter } from "./sidebarSorter"; export default hopeTheme({ hostname: "https://rle.wiki/", @@ -20,7 +21,7 @@ export default hopeTheme({ sidebar: sidebar, - sidebarSorter: ["readme", "order", "title", "filename"], + sidebarSorter: mySidebarTitleSorter, breadcrumb: false,