[WIP] Properly exclude folders
I made a very small change, which will properly exclude folders (and therefore somewhat fix #68). This will only exclude the "actual" folder though, subfolders still get treated normally. Depending on use-case, this could be favorable or annoying.
I would propose keeping it this way, and adding some basic form of regex (ie. media/*) for also excluding subfolders, but I haven't looked into how that should get implemented yet.
Hey! Thanks for your work, i marked this PR as a draft while it is still WIP :)
I just figured out that as the excludedFolders are treated as regex, my suggestion already works. It just has to be proper regex. For example, unsorted/.* excludes 'unsorted' and all its subfolders.
You can decided if you want to keep it proper regex, or maybe add a little .replace("*", ".*") (or something a bit more robust) in there so that "more obvious" wildcards like unsorted/* are supported.
If you want to keep the proper regex, this PR should be ready to merge.
Edit: I would change the placeholder in PluginSettingsTab.ts in line 113 to include a line with either * or .* before merging this.
I think adding the placeholder is a really good idea, mind adding that for me? :) I think most ppl aren't aware that it requires to be a valid regex that matches the entire path to be excluded, maybe even add a message in it that it does infact only support regex
Sorry I was busy, I added if (excludedFolder.endsWith("/*")) excludedFolder = excludedFolder.slice(0, -1) + ".*"; which seems to work. I don't know if there's a more "proper" way to implement this, but I think it should be fine this way.
Just not sure if its the right move to simply modify the expressions, i think adding more awareness is more important?
Oh oops I forgot to mention, I also changed one of the lines in the Excluded Folders box:
I guess for even more awareness you could add another bullet point to the Features in the README, maybe something like
- regex support for excluding folders
Would just add it in the description of the option i guess
If you tell me what you want the description to be I can change it to that, I suck at formulating concise descriptions lol
I'm still not sure how to get this to work. No matter what I do, the folders continue to allow TOC to appear.
I've tried both ways - what I can't do is add hundreds of folders to this list and manually update it. I really need a method of restricting the TOC creation at the top level so it never spawns in certain locations.
Or, even better, a way to turn off the automatic creation and just spawn a TOC via hotkey.
I'm still not sure how to get this to work. No matter what I do, the folders continue to allow TOC to appear.
![]()
I've tried both ways - what I can't do is add hundreds of folders to this list and manually update it. I really need a method of restricting the TOC creation at the top level so it never spawns in certain locations.
Or, even better, a way to turn off the automatic creation and just spawn a TOC via hotkey.
It's been a while since I used this / looked at the code, but this should work on the normal release:
attachments/attachments.mdorattachments/.*
Additionally, when using my fork, this should also work:
attachments/*
I have no idea how spaces are handled, but this should also work for your other folder.
