raincat1998 / obsidian-custom-attachment-location Goto Github PK
View Code? Open in Web Editor NEWCustomize attachment location with variables($filename, $data, etc) like typora.
License: MIT License
Customize attachment location with variables($filename, $data, etc) like typora.
License: MIT License
obsidian-custom-attachment-location/main.ts
Lines 194 to 195 in 4654761
I believe this should be:
this.updateAttachmentFolderConfig(path);
if (!await this.adapter.exists(path)) {
await this.adapter.mkdir(path);
}
Edit: I might be wrong about this. Still debugging
When copying or dragging non-image attachments (such as PDFs), I found that the custom attachment directory is not created correctly, and the attachments are placed in the root directory.
For the drop event, a potential solution I thought of is to first prevent the default drop event, wait for the directory to be created and then re-dispatch the native Obsidian drop event.
However, I am not familiar with the Obsidian API and do not know how to re-dispatch the original event. Can someone provide some information or help fix this?
Not works if the location set to a invisible folder(eg: .attachments)
Location for New Attachments: .attachments/${filename}
But not works, I want to make the attachment folder invisible.
I do like this plugin, it provides me with a Typora experience. But it still has some features that make me not adapt to it.
OS: Mac
${date}
, the image file name would be changed.I want to keep the name of the image file as a local file name, or the name from the internet. Is it possible?
Add some options that may be solutions:
I know typing ![[
, then selecting the image file from the files' list could work, but there are many images in my folder, and I'd like to choose images from Finder.
Hello,
On desktop and mobile (iPad), drag and drop still does not change the image name to custom name (here ${filename}). I've tested with .png
, .jpeg
and .jpg
files.
Wasn't the latest release supposed to solve that issue ?
Thank you !
Obsidian 1.0.3
Plugin 0.0.9
Windows 11
iPad OS 15.7
Currently, I have all of my attached files in "assets".
I would like to have them in "assets/${filename}", but no matter which file I have open and dragging and dropping files into - all of the files go to "assets/Monitor" (Monitor.md was the first note I tried the plugin in).
I tried to restart Obsidian, reinstall the plugin etc.
When you have multiple images in the clipboard, only the first one is being pasted
How to write the variable of the parent folder?Thanks!
So im trying to have a specified folder for all my audio recordings, I thought your plugin would do the job but it doesn't seem like it. I am interested in making my own plugin that does that if it's possible but thought that maybe u can easily implement it to your plugin instead of me making my own one. If u don't wanna make it plz lmk if that is actually doable, i havent made any plugins before and still a beginner in JS
just in the title
plugin settings:
location for new attachments: ./${filename}
plugin version: 0.0.6
obsidian version: 0.13.23
When I drag-n-drop image or other file and folder for this note wasn't created before, plugin just create attachment folder without copying file to this attachment folder.
Can recreate in new vault with legacy editor, but can't understand why sometimes It works and sometimes not. Mostly not is attachment folder wasn't created by plugin before. Can post video if you need.
When I paste an image, I usually want to resize the image to make it smaller, so I change ![[2022-12-07-1438.jpeg]]
to ![[2022-12-07-1438.jpeg|200]]
. I'd like to automatically add the |200
upon paste so I don't always need to do it myself, and this could potentially be accomplished by allowing the user to fully customize what text is pasted (could also disable the default embedding of images by removing the preceeding !
... I wouldn't do this but perhaps someone would).
Thanks for the great plugin, this is just what I was looking for. However, I'm experiencing a bug where pasting an image pastes two copies: one via the obsidian-custom-attachment-location (in my desired folder), but another link and file in the default Obsidian behavior (the main attachments folder for my entire vault). This behavior remains after disabling all other community plugins and does not occur when images are dragged.
Here is a typical response I see after pasting an image:
(the first image is the desired one from obsidian-custom-attachment-location, the second is default Obsidian)
I write ./${filename}.md/assets
in Location box. But when inserting a image to a note, the image file was never created successfully.
I don't think the plugin has the ability to check if a directory exists and generate one if it doesn't. Is it possible to add this feature to the next release?
Settings:
Behavior:
Suggestions:
Desired Behavior: asset folder does not show up in Obsidian Navigation pane and image links still work as expected.
Can you add a date variable to the attachment path? I want to create a new folder every month according to the date to store the attachment file of the corresponding month, just like qq stores the received pictures.
In addition, is there any conflict between this plug-in and local images plus? It needs to be combined with this plug-in to automatically download all web images and store them in the corresponding month folder according to the date.
Current plugin version: 3.0
After pasting normal text, it will automatically be pasted one more time, unless the plugin is disabled.
@RainCat1998 your project is truly amazing. I am a huge fan of it.
But I cannot ignore the fact that your response time is quite big.
Based on your GitHub activity, you have huge gaps in your availability.
Maybe your project will benefit from including additional contributors with write permission?
If you are open to it, please consider my candidacy.
Hello,
Will it be possible to use this with Obsidian Canvas?
Thanks!
Any possibility for adding iOS support to this plugin?
Is there a way to target a specific folder in the root of the vault?
-Vault Root
--Attachments
--Notes
---note.md
Is there a way when I paste an image into note.md it automatically be saved into Attachments/note/ folder?
tnx
Hello,
I noticed Custom Attachment Location does not work for files from the audio recorder (Obsidian core plugin) : is this the expected behavior ? Is there any plan to support it ?
Thanks !
your plugin is working flawlessly. Thanks a ton for making this, it's really useful.
I imagine this would take a bit of work, but just wanted to suggest that it'd be a great feature if there was a way to keep the attachment folder name synchronized with the note's filename. I often rename notes and it'd be fantastic if there was a way to automatically rename the attachment folder and associated links.
If I am saving attachments to a folder called "2022-01-26 Meeting", I would like the ability to rename an attachment to be {folderName}-{filename}.
That way I will recognize the file names even if they get decoupled from the folder, or if I am using an external tool to search by file names.
If you like the feature, I may give it a go in a local branch.
if I delete a picture in md, the assets fold won't change.
Hello,
Thanks for this great plugin ! I just noticed that drag and drop still does not work : it does not change the image name to my custom name (${filename}).
Wasn't the latest release supposed to solve that issue ?
Thanks !
Obsidian 0.13.19
Plugin 0.0.6
Windows 10 21H2
Obsidian Pandoc plugin could not find the assets when exporting PDF or docx format file. It tries to find images in the root folder. Is there a way to work around this incompatibility?
The plugin handles only paste and drag-and-drop scenarios and it seems the attachment folder is not updated if used plain Insert Attachment command
Hi,
To bulid a more compatible vault, I'm looking for a way to attachment images using Markdown format ![]()
with relative path, meanwhile linking notes using Wikilinks format [[ ]]
.
Sadly, while obsidian supports both these format and provides option to turn off Use [[Wikilinks]]
, it would affect both images links and note links. I wonder if you could consider to add a option to let us attachment images using only Markdown links format with relative path. If implement this feature, the note file could be more compatible, as the images attached could be correctly read by most markdown editor.
After all, thanks for your amazing plugins!
OldName.md
without any attachmentsNewName.md
Attachment.pdf
to renamed noteActual result: Attachment.pdf
is added to the folder corresponding to OldName.md
Expected result: Attachment.pdf
is added to the folder corresponding to NewName.md
closed
Path like this: ./../_images
not work
Hi, I really like the idea of having attachments ordered in folders that match notes name.
I tried this plugin without success.
v 0.0.7
Setting:
Location for new attachments: assets/${filename}
Automatic rename [...]: Checked
Problem:
The first attachment is not saved into the requested folder.
Reproducable behaviour:
... if it is of any importance: I am using Obsidian on Win10, Workspace is located on mapped NAS
it's a great extensition that could define the ${file} and ${date} with the image location & filename.
sometimes I want to make the filename more meaningful and the VsCode extension "Markdown Image" just support ${prompt}: Makes it possible to enter a custom name through an input prompt when pasting the image.
Currently if I move the note to another folder, I have to move attachments folder manually.
I was considering plugin https://github.com/dy-sh/obsidian-consistent-attachments-and-links it is extremely inefficient for big vaults
if we have notes as tree:
if set images root path in /assets, hope to have same directory structure
now, if we set 'Location for New Attachments' = 'assets/${filename}', only have filename as directory
so, if implement this feature, we can have all image in one root directory and easy to find all images of one note according path
thank you for this amazing plugin.
After deleting a note it's attachment folder and contents still remains.
Fixing this would be awesome!
.obsidian/app.json
has been changed too often, and I use git on the whole vault, which causes many commits.
Even if I change the current view, without adding any attachments.
Having a ++ But - Obsidian does not like ++ in a title causes error. It is the leading ++ that causes the problem.
I use + Title and ++ Title to make those files float to top of the list in a sorted view.
The console log of Obsidian shows
SyntaxError: Invalid regular expression: /^./_resources/++ Bug - Obsidian does not like ++ in title$/: Nothing to repeat (at plugin:obsidian-custom-attachment-location:4558:12)
at new RegExp (<anonymous>)
at CustomAttachmentLocationPlugin.interpolateToDigitRegex (plugin:obsidian-custom-attachment-location:4558:12)
at CustomAttachmentLocationPlugin.getEarliestAttachmentFolder (plugin:obsidian-custom-attachment-location:4584:30)
at CustomAttachmentLocationPlugin.getAttachmentFolderPath (plugin:obsidian-custom-attachment-location:4600:23)
at CustomAttachmentLocationPlugin.handleFileOpen (plugin:obsidian-custom-attachment-location:4697:29)
at eval (plugin:obsidian-custom-attachment-location:4492:41)
at e.tryTrigger (app.js:1:723190)
at e.trigger (app.js:1:723123)
at t.trigger (app.js:1:2283688)
at t.activeLeafEvents (app.js:1:2269215)
at l (app.js:1:522936)
at c (app.js:1:523052)
This plugin feels unusable for someone who switches between mobile and desktop since the plugin won't work on mobile
Hi! Thanks for your plugin. Some remarks:
Obsidian 0.13.19.
Hi there,
I was trying to use a hidden folder ./.screens/${filename}
as the Location for New Attachments
but it does not work when I paste some images. All the other settings are still the default one.
The folder and subfolder are correctly created but the file (PNG picture in this case) never appear in the folder nor in the note.
Let me know if you need more info.
I would like to have an option to toggle image renaming on / off. Currently I'm renaming files and giving images descriptive names, so I'd like to be able to disable this plugin from force renaming my images. I like the attachment location option with {filename} variable, really handy, but renaming images is unnecessary for me. Is there a way to disable it and if not, please make this a feature.
Currently, the duplicate number delimiter is whitespace. Can I set the delimiter to be hyphen?
So when I paste three images, they will be named image
, image-1
, image-2
, instead of image
, image 1
, image 2
.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.