From f5980740cb99f0fa04cd0c66c6f5dba6ea78c288 Mon Sep 17 00:00:00 2001 From: Andrew McClenaghan Date: Mon, 1 May 2023 00:12:54 +1000 Subject: [PATCH] feat: Add support for "index.md" as a folder file --- packages/lib/src/TreeLocal.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/lib/src/TreeLocal.ts b/packages/lib/src/TreeLocal.ts index c1fa35e2..a216173c 100644 --- a/packages/lib/src/TreeLocal.ts +++ b/packages/lib/src/TreeLocal.ts @@ -60,9 +60,15 @@ const addFileToTree = ( const processNode = (commonPath: string, node: LocalAdfFileTreeNode) => { if (!node.file) { - const indexFile = node.children.find( + let indexFile = node.children.find( (child) => path.parse(child.name).name === node.name ); + if (!indexFile) { + // Support FolderFile with a file name of "index.md" + indexFile = node.children.find( + (child) => path.parse(child.name).name === "index" + ); + } if (indexFile) { node.file = indexFile.file;