dy-sh / obsidian-unique-attachments

Obsidian plugin. Renames attachments, making their names unique.
MIT License
45 stars 5 forks source link

Feature Request: Rename according to note tile plus the hash or MD5 #7

Open magi44ken opened 3 years ago

magi44ken commented 3 years ago

Hi,

Thanks for creating this plugin. This is a very useful plugin to rename images or attachments. Can you also add a settings to allow the user to choose different filename format to use?

For example, I would like to rename the attachments and images with the same name as note title and attach MD5 hash at the end of the note title.

In the setting, there will be pre-tags or variables that the user can choose to use.

Tags Examples

<note-title> use note title
<md5-hash> use hash from MD5
<vault-title> use vault name
<note-folder-title> use the current name of the folder that the note is located in.
<date-YYYY-MM-DD> use current date in this format 2021-07-31 (include leading zero)
<date-MM-DD-YYYY> use current date in this format 07-31-2021 (include leading zero)
<date-MM-YYYY> use current date in this format 07-2021 (include leading zero)
<date-YYYY-MM> use current date in this format 2021-07 (include leading zero)
<date-YYYY> use current year only in this format 2021
<time-HH-MM-SS-AM/PM> use current time in this format 01.30.45-PM (include leading zero)
<time-HH-MM-AM/PM> use current time in this format 01.30-PM (include leading zero)

etc...

Vault Example

Folder1/Note10.md Folder2/Note20.md

Example 1:

<note-title>-<md5-hash>

Filename Result: Note10-hash.jpg Filename Result: Note20-hash.jpg

Example 2:

My <date-YYYY>-<note-folder-title>-<note-title>

Filename Result: My 2021-Folder1-Note10.jpg Filename Result: My 2021-Folder2-Note10.jpg

Thanks.