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

[FR]: Add ability to upload all files (attachments) in path relative to file #376

Closed
1 task done
dneez opened this issue Jan 12, 2025 · 1 comment
Closed
1 task done
Assignees

Comments

@dneez
Copy link

dneez commented Jan 12, 2025

Issue validation

  • I checked the issue to prevent duplicate

Is your feature related to a problem ?

No response

What solution do you want to see ?

I would like to be able to upload all attachments (files) in the folder where md file resides.
For example with following structure:

Blog
  PostName
    PostName.md
  images
    image1.jpg
    illustration2.png
    ...

Currently it will only upload .md file and whatever is linked inside file. My theme uses a lot of images in frontmatter.
I would like anything in images folder to be uploaded as well.

I know that I could use front matter key to specify which attachments to upload, but my frontmatter is hierarchical and it looks like plugin can't handle it.
Example of frontmatter:

---
share: true
galleryImages1:
  - image: images/image1.jpg
    caption: Caption1
  - image: images/image2.JPG
  - image: images/image3.JPG
    caption: Capture3
---

Describe the alternative you've considered

I have considered to change handling of frontmatter in plugin. In the logic, that checks forntmatter for key you assume forntmatter has one dimension, hence usage of const fieldValue = dataviewMetadata[field];

Maybe the frontmatter object could be flattened to one dimension, something like this:
Given my example frontmatter

---
share: true
galleryImages1:
  - image: images/image1.jpg
    caption: Caption1
  - image: images/image2.JPG
  - image: images/image3.JPG
    caption: Capture3
---

Resulting object could be

{
  'share': true,
  'galleryImages1.[0].image': 'images/image1.jpg',
  'galleryImages1.[0].caption': 'Caption1',
  'galleryImages1.[1].image': 'images/image2.jpg',
  'galleryImages1.[2].image': 'images/image3.jpg',
  'galleryImages1.[2].caption': 'Caption3',
}

Then we could also match key by RegEx. Example: /galleryImages\d+\.\[\d+\]\.image/

OS

Windows

Anything else?

No response

Plugin version

7.5.2

Obsidian version & debug log

Obsidian: 1.8.1
@Mara-Li
Copy link
Member

Mara-Li commented Jan 12, 2025

Create a markdown file that list all file with embed, as a sort of "gallery", it will force to push theses files.

I won't add this as a FR, sorry. THe plugin have a lot of settings and possibility without adding this.

@Mara-Li Mara-Li closed this as completed Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants