fumadocs-core 13.4.6 → 13.4.8
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/dist/source/index.js +4 -3
- package/dist/toc.js +1 -1
- package/package.json +1 -1
package/dist/source/index.js
CHANGED
|
@@ -70,7 +70,7 @@ function resolvePath(from, join) {
|
|
|
70
70
|
|
|
71
71
|
// src/source/page-tree-builder.ts
|
|
72
72
|
var group = /^\((?<name>.+)\)$/;
|
|
73
|
-
var link =
|
|
73
|
+
var link = /^(?:\[(?<icon>[^\]]+)])?\[(?<name>[^\]]+)]\((?<url>[^)]+)\)$/;
|
|
74
74
|
var separator = /^---(?<name>.*?)---$/;
|
|
75
75
|
var rest = "...";
|
|
76
76
|
var extractPrefix = "...";
|
|
@@ -108,15 +108,16 @@ function resolveFolderItem(folder, item, ctx, addedNodePaths) {
|
|
|
108
108
|
}
|
|
109
109
|
const linkResult = link.exec(item);
|
|
110
110
|
if (linkResult?.groups) {
|
|
111
|
-
const { url, text } = linkResult.groups;
|
|
111
|
+
const { icon, url, text } = linkResult.groups;
|
|
112
112
|
const isRelative = url.startsWith("/") || url.startsWith("#") || url.startsWith(".");
|
|
113
113
|
const node = {
|
|
114
114
|
type: "page",
|
|
115
|
+
icon: ctx.options.resolveIcon?.(icon),
|
|
115
116
|
name: text,
|
|
116
117
|
url,
|
|
117
118
|
external: !isRelative
|
|
118
119
|
};
|
|
119
|
-
return [ctx.options.attachFile?.(node) ?? node];
|
|
120
|
+
return [removeUndefined(ctx.options.attachFile?.(node) ?? node)];
|
|
120
121
|
}
|
|
121
122
|
const isExcept = item.startsWith(excludePrefix), isExtract = item.startsWith(extractPrefix);
|
|
122
123
|
let filename = item;
|
package/dist/toc.js
CHANGED
|
@@ -49,7 +49,7 @@ function useAnchorObserver(watch, single) {
|
|
|
49
49
|
if (element.scrollTop === 0 && single) setActiveAnchor(watch.slice(0, 1));
|
|
50
50
|
else if (element.scrollTop + element.clientHeight >= element.scrollHeight - 6) {
|
|
51
51
|
setActiveAnchor((active) => {
|
|
52
|
-
return active.length > 0 ? watch.slice(watch.indexOf(active[0])) : watch.slice(-1);
|
|
52
|
+
return active.length > 0 && !single ? watch.slice(watch.indexOf(active[0])) : watch.slice(-1);
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
}
|