Skip to content

Commit

Permalink
feat: Add support for "index.md" as a folder file
Browse files Browse the repository at this point in the history
  • Loading branch information
andymac4182 committed Apr 30, 2023
1 parent 28ae75e commit f598074
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/lib/src/TreeLocal.ts
Expand Up @@ -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;
Expand Down

0 comments on commit f598074

Please sign in to comment.