Conversation
|
Thanks! I think it makes sense for the plugin to support folder notes out of the box like this. A few thing I'd like to see fixed before merging it in. Site logo regressionThe current main has a conditional block in filetree.njk that renders a site logo when meta.siteLogoPath is set. This PR replaces it with just an Recursion bug in detectFoldersWithFolderNotesThe function misses folder notes at certain nesting depths. It iterates entries of the passed object, and for each folder checks its children. But when it recurses on a child folder via else if (child.isFolder), the recursive call makes that Example: with A/A.md/B/B.md/C/C.md, A and C get detected but B does not. Fix would be to always recurse into folders separately from the matching logic: function detectFoldersWithFolderNotes(tree) {
for (const [name, entry] of Object.entries(tree)) {
if (entry.isFolder) {
for (const [childName, child] of Object.entries(entry)) {
if (child.isNote && childName === name + ".md") {
child.hide = true;
entry.folderNote = child;
}
}
detectFoldersWithFolderNotes(entry);
}
}
}Also a minor nit: missing semicolon on fileOrFolder.folderNote = child. |
|
Rebased and simplified the recursion code, dropped the style reformat commit, tested on my personal vault. |
For folders with folder notes the click target to open the folder instead of navigating to the folder note is just the '>' icon, we should consider making it bigger.
Also, there's currently no "active-note" highlighting for folder notes, and the link doesn't have the typical underline on hover.
Even so it works pretty well overall, and I didn't notice any increase in build times.
Tested on my personal vault which uses LostPaul/obsidian-folder-notes
Closes oleeskild/obsidian-digital-garden#237
Closes oleeskild/obsidian-digital-garden#669