This plugin is archived and will no longer be maintained. Personally, I've switched to using Trilium as I found managing attachments and syncing notes manually with Obsidian a bit tedious. That said, Obsidian is still an excellent tool, and I have no criticisms of it. Thank you for using this plugin—I hope it is/has been helpful to you.
This plugin will format all attachments in the format: "noteName attachmentFormat indexNumber.xxx"
The attachmentFormat are image, audio, video and pdf. IndexNumber is ascending number from 1 based on the attchmentFormat.You can change the default format for different type of attachments and the connector in the setting. Basically, there are three components can be enabled or disabled in attachment name: noteName, time (format time), and pathHash (absolute note path hash). Therefore, there could be seven types for the attachment name format:
- noteName attachmentFormat indexNumber.xxx
- noteName attachmentFormat indexNumber time.xxx
- noteName attachmentFormat indexNumber pathHash.xxx
- noteName attachmentFormat indexNumber time pathHash.xxx
- attachmentFormat indexNumber time.xxx
- attachmentFormat indexNumber pathHash.xxx
- attachmentFormat indexNumber time pathHash.xxx
The space in between can be set by your choice, even use nothing in between.
There is a one-in-many situation, which means using the same attachment in many different notes. In this plugin, it gives three options to handle this situation:
- Default: Always rename with the note name;
- Copy: Create a copy for the attachment and rename with the new note name;
- NoChange: Stick to the first time that attachment is renamed, and will not occupy index number
When using "Copy" mode, it will take a bit longer time than usual renaming time, around 1-2s. For "NoChange" mode, if you want to rename the attachment after it's renamed by this plugin, you need to rename it by yourself in the valut or in the file system right now. May add a Command later to handle this.
Note: The base path of the attachments is based on the Valut setting: Files & Linsk -> Attachment folder path.
- Format attachments in active file, such as "noteName image 1.png". Format time and absolute note path hash can add into attachment name, such as "noteName image 1 20220101000000.png", "noteName image 1 6666cd76.png". Defualt setting is not adding time and path hash. You can also exclude the noteName in the attachment noteName, but the time suffix will be added automatically.
- Format attachmnets in selected folder (support recursively)
- Format attachments with customize subfolder for each attachment type, and can add note name as another level subfolder
- Attachment name can be customized for each type of attachment, you can use any character that allowed in a note name
- Attachment type not supported officially can be added in the setting
- Connector (the character between noteName, attachmentFormat, indexNumber, time and pathHash) can be customized, you can use any character that allowed in a note name. You can also customized different connectors seperately or even don't use connector.
- Add new attachment -> will rename the attachment based on type and index
- Change order -> will rename attachments with new order
- Delete attachment -> will rename attachments with new order
- Export attachmnets in current file and save as a zip file (can be deleted after export), only avaliable in desktop now
- Export unused attachment in the vault and save as a zip file (can be deleted after export), only avaliable in desktop now
- Image files: png, webp, jpg, jpeg, gif, bmp, svg, avif
- Audio files: mp3, wav, m4a, ogg, 3gp, flac
- Video files: mp4, webp, ogv, mov, mkv
- PDF files: pdf
webm
file type will be regard as vedieo even if it can be audio.
Customized attachment format can be added in the setting.
- When delete an attachment which is already renamed, it will not rename and will occupy the indexNmuber for this note. But will be renamed to tmp_xxx if there is a conflict later.
- When there are two attachments have same name but in different paths, the function will not work correctly. Try to not change the setting "Files & Links -> Default location for new attachments".
~~- When deleting attachment in a file, rename it with "noteName attachmentFormat unuse 1.xxx".
- When deleting an attachment that no other file using this attachment, delete it from vault. (Could be disable)~~
- Setup change log tool
npm install -g commitizen
npm install -g conventional-changelog-cli
- Update change log
git add .
git cz
- Update version
npm run version --new=<new_version>
- Push tag
git push origin --tag
I develop this plugin as a hobby, spending my free time doing this. If you find it valuable, then please say THANK YOU or buy me a coffee...
MIT