Core: Fix link items text

This commit is contained in:
fuma-nama
2024-09-07 23:38:32 +08:00
parent 78e59e7f6a
commit 083f04a53a
3 changed files with 9 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-core': patch
---
Fix link items text
@@ -116,14 +116,14 @@ function resolveFolderItem(
const linkResult = link.exec(item);
if (linkResult?.groups) {
const { icon, url, text } = linkResult.groups;
const { icon, url, name } = linkResult.groups;
const isRelative =
url.startsWith('/') || url.startsWith('#') || url.startsWith('.');
const node: PageTree.Item = {
type: 'page',
icon: ctx.options.resolveIcon?.(icon),
name: text,
name,
url,
external: !isRelative,
};
+2
View File
@@ -166,12 +166,14 @@ test('Nested Directories', async () => {
},
{
"external": true,
"name": "Text",
"type": "page",
"url": "https://google.com",
},
{
"external": true,
"icon": "Icon",
"name": "Text",
"type": "page",
"url": "https://google.com",
},