akosbalasko / zoottelkeeper-obsidian-plugin

Obsidian plugin of Zoottelkeeper: An automated folder-level index file generator and maintainer.
182 stars 11 forks source link

Allow placing folder notes outside of the folder, e.g. by using a prefix `../` #59

Open 229c9cf0 opened 2 years ago

229c9cf0 commented 2 years ago

(Not sure whether this is a feature request or a bug in an existing feature.)

I already have index notes that live outside the enclosing folder, i.e.

.
├── foo.md
├── foo
│   ├── bar.md
│   └── bar
├── baz.md
└── baz

I'd like the auto-generated part to be included in those notes. I can set note name prefixes without / and the custom name feature works fine, but if I set it to e.g. ../ then nothing happens (including no error messages / warnings in the console.)

This should either work or produce an error message of some kind. (In the latter case, I'd also love to see a feature that would allow this mode of use.)

229c9cf0 commented 2 years ago

I looked into this some more and locally edited the code to make it work for me by just ripping out the whole prefix choice thing and hard-coding my variant. Turns out the code is written in a way that assumes index files will never be in a different folder (the index generation works off the path of the index file), so there's lots of things that have to be adjusted all at once or else things break in hilarious ways.

Doing this properly would involve moving to a different intermediate data structure (e.g. passing around folder names and not index file names, then deriving the index name from the folder name wherever it's needed.)

I'd still like to see this in the main plugin eventually, but I thought it'd be a good idea to warn anyone attempting this that it'll be at least a 2-step process.