Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Properly exclude folders #77

Closed
wants to merge 4 commits into from

Conversation

Eco-Gaming
Copy link

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.

@turulix turulix marked this pull request as draft April 12, 2024 13:17
@turulix
Copy link
Owner

turulix commented Apr 12, 2024

Hey! Thanks for your work, i marked this PR as a draft while it is still WIP :)

@turulix turulix added the bug Something isn't working label Apr 12, 2024
@Eco-Gaming
Copy link
Author

Eco-Gaming commented Apr 12, 2024

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.

@turulix
Copy link
Owner

turulix commented Apr 12, 2024

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

@turulix turulix self-assigned this Apr 12, 2024
@turulix turulix added enhancement New feature or request and removed bug Something isn't working labels Apr 12, 2024
@Eco-Gaming
Copy link
Author

Eco-Gaming commented Apr 19, 2024

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.

@turulix
Copy link
Owner

turulix commented Apr 25, 2024

Just not sure if its the right move to simply modify the expressions, i think adding more awareness is more important?

@Eco-Gaming
Copy link
Author

Oh oops I forgot to mention, I also changed one of the lines in the Excluded Folders box:
Screenshot from 2024-04-25 10-24-20
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

@turulix
Copy link
Owner

turulix commented Apr 26, 2024

Would just add it in the description of the option i guess

@Eco-Gaming
Copy link
Author

If you tell me what you want the description to be I can change it to that, I suck at formulating concise descriptions lol

@SyndicatedPillbug
Copy link

SyndicatedPillbug commented Aug 31, 2024

I'm still not sure how to get this to work. No matter what I do, the folders continue to allow TOC to appear.
image
image

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.

@Eco-Gaming
Copy link
Author

I'm still not sure how to get this to work. No matter what I do, the folders continue to allow TOC to appear. image image

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.md or
  • attachments/.*

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.

@turulix
Copy link
Owner

turulix commented Dec 11, 2024

Closing this in favour of #93

@turulix turulix closed this Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Excluded Folders does not seem to be working at all
3 participants