@alauda/doom 1.10.10 → 1.10.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/theme.js +12 -2
- package/package.json +1 -1
package/lib/theme.js
CHANGED
|
@@ -10,7 +10,17 @@ import { useTranslation } from './runtime/index.js';
|
|
|
10
10
|
// eslint-disable-next-line import-x/export
|
|
11
11
|
export * from '@rspress/core/theme';
|
|
12
12
|
const X = getCustomMDXComponent();
|
|
13
|
+
const cleanupUrlPath = (urlPath) => {
|
|
14
|
+
if (urlPath.endsWith('.html')) {
|
|
15
|
+
urlPath = urlPath.slice(0, -5);
|
|
16
|
+
}
|
|
17
|
+
if (urlPath.endsWith('/index')) {
|
|
18
|
+
urlPath = urlPath.slice(0, -5);
|
|
19
|
+
}
|
|
20
|
+
return urlPath;
|
|
21
|
+
};
|
|
13
22
|
const getClosestSidebar_ = (sidebarItems, pathname, exportItem, matched, depth = 0) => {
|
|
23
|
+
pathname = cleanupUrlPath(pathname);
|
|
14
24
|
for (const sidebar of sidebarItems) {
|
|
15
25
|
if ('_fileKey' in sidebar && sidebar._fileKey) {
|
|
16
26
|
if (depth === 0) {
|
|
@@ -23,8 +33,8 @@ const getClosestSidebar_ = (sidebarItems, pathname, exportItem, matched, depth =
|
|
|
23
33
|
depth,
|
|
24
34
|
};
|
|
25
35
|
}
|
|
26
|
-
|
|
27
|
-
|
|
36
|
+
const sidebarLink = cleanupUrlPath(withBase(sidebar.link));
|
|
37
|
+
if (sidebarLink === pathname) {
|
|
28
38
|
return matched;
|
|
29
39
|
}
|
|
30
40
|
}
|