Attachment Placement
pendingby Hunter Baker
Define rules for more advanced and custom placement of newly created attachments.
Overview
This plugin is meant to make resource placement more flexible and context-aware.
Instead of forcing all new resources into a single hardcoded folder, it lets you define where resources should go based on the file or folder you’re currently working in. The plugin will walk up the directory tree and use the first placement rule it finds.
This plugin would likely be useful for people who like to copy-paste in images and would like some further organization.
Links
How To Use
Placement rules can be defined on individual folders.
When a new resource is created:
- The plugin checks if the current folder has a placement rule.
- If not, it checks the parent folder.
- This continues upward until a rule is found.
- The resource is placed according to that rule.
To get started with the plugin, open up the settings and define some rules for which attachments should be placed.
Once there are rules set, the plugin will pay attention to new files being created and handle them according to the rules set.
Example
Given the following structure:
/
├── attachments/
│ ├── school/
│ ├── journal/
│ └── videogames/
├── journal/
├── league-of-legends/
├── dragon-age-origins/
└── school/
└── math/
├── factoring.md
└── addition.md
If we are working within addition.md, we will check its parent folder (math/) for a placement rule, if it exists, related resources will be placed using that rule.
If it does not exist, we will check the next parent (school/). We continue this parent checking sequence until we hit a rule that we can use or hit the root folder.
If no rule is found, the plugin uses the fallback location defined in settings.
To complete the example, these are what some actual placement rules might look like:
If you'd like another example, check out the help page.
Future Roadmap
- Allow sources to be
.mdfiles for even finer control. - Option to parse and re-sort through all attachments in specific folders
Support
If you found this project helpful or enjoyable, and want to support future work, you can buy me a coffee on Ko-fi
Totally optional, always appreciated.
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.