kitschpatrol / yanki-obsidian

An Obsidian plugin for automated flashcard syncing from a folder in your vault to Anki. Pure Markdown syntax. No fuss.
MIT License
35 stars 1 forks source link

Images in custom attachment folder don't work #3

Closed xelaras closed 3 months ago

xelaras commented 3 months ago

My attachments are in the following folder: \300 Conoscenza\390 allegati

If I reference an image from that folder, I get the following error: image

I get the same error if I move the image into another folder.

If I however put the image in the vault root folder, it works.

kitschpatrol commented 3 months ago

Thanks for trying the plugin, and sorry you ran into trouble with attachments.

Can you please share the complete Markdown from the note referencing wop-agenda.jpg? Thank you.

kitschpatrol commented 3 months ago

Also I'm transferring this issue to the yanki-obsidian repository since it's specific to the Obsidian plugin.

kitschpatrol commented 3 months ago

I've been able to reproduce this, I actually didn't realize that Obsidian will let you embed an attachment from outside of the designated attachments folder without a relative path. Seems a little freewheeling. 😅

Here's my test configuration:

Obsidian vault structure:

î—¿ 'Yanki Issue 3'
├──  '300 Conoscenza'
│  └──  '390 allegati'
│     └──  wop-agenda.jpg
├──  Anki
│  └──  Test.md
└──  wop-agenda-root.jpg

Test.md Markdown:

Non-relative attachment from the vault folder `\300 Conoscenza\390 allegati`:

![[wop-agenda.jpg]]

---

Attachment from the vault root:

![[wop-agenda-root.jpg]]

Both of the images render correctly in Obsidian, but Yanki is failing to resolve ![[wop-agenda.jpg]] during the export process because it can't figure out its path.

I'm looking into how to fix this, in the meantime changing your embed code to a relative path like below should allow syncing to Anki:

![[../300 Conoscenza/390 allegati/wop-agenda.jpg]]
kitschpatrol commented 3 months ago

Quick update:

I dug into this issue a bit further, and due to the ambiguities around links in Obsidian vs. links in standard Markdown, the fix is going to be a bit more involved than I anticipated.

There are APIs inside Obsidian that can handle this, but I'm going to need to reimplement them for consistency with the stand-alone yanki CLI tool and library.

So, for now please use the relative link fix described above, or consider a Plugin like consistent-attachments-and-links which can automate good relative link hygiene.

I'll keep this issue open and update it when a more permanent fix is available.

jakeoung commented 3 months ago

It would be great if there is an option to generate anki notes even if there is an attachment error.

kitschpatrol commented 3 months ago

Agreed, an update with a fix is coming very soon.

kitschpatrol commented 3 months ago

@jakeoung @xelaras A fix for this plus some other improvements is in the just-release version 1.1.0.

Thanks for your patience and please let me know if this resolves the issues on your side.

kitschpatrol commented 3 months ago

Closing this since it appears to be resolved in the latest version. Please reopen if necessary.