debanjandhar12 / logseq-anki-sync

An logseq to anki syncing plugin with superpowers - image occlusion, card direction, incremental cards, and a lot more.
GNU Affero General Public License v3.0
453 stars 31 forks source link

Image references can't be exported to Anki depending on the PDF's name #114

Closed piskel closed 1 year ago

piskel commented 1 year ago

Images from PDF references are not displayed in Anki depending on the name of the PDF file.

Eg. : "Lecture 05 - Cardiovascular System I.pdf" does not work But "CardiovascularSystem.pdf" works

debanjandhar12 commented 1 year ago

Seems like the bug is due to large media file name (anki seems to limit at 100 chars). Also, AnkiConnect doesn't seem to support Media directories.

While I can think of hash based solutions for this, an better approach would be to just use the base file names instead of encodedURI of Full Path for now and wait for AnkiConnect to implement Directory Support for media. This will work with almost no chance of conflicts cuz logseq filename are random uuids.

debanjandhar12 commented 1 year ago

Fixed. It will be available in v4.0.0.

piskel commented 1 year ago

I built the project with the fix, however, it seems that the issue still persists. Images are still not sent to Anki. It also seems like the images are simply not detected, because in the "Config" field of the Anki card, the "assets" parameter is empty, like if there was no images at all in the block in Logseq.

piskel commented 1 year ago

Also, the name of the PDFs aren't usually 100 characters long. I have issues with filenames as short as "Lecture 04-Cell". And while I think the file name might be a cause for this issue, there might be other reasons involved. 15% of the cards in my deck are missing their images, which makes them hardly usable. I can send my Logseq graph through PM if it can help resolve those issues.

debanjandhar12 commented 1 year ago

Also, the name of the PDFs aren't usually 100 characters long. I have issues with filenames as short as "Lecture 04-Cell". And while I think the file name might be a cause for this issue, there might be other reasons involved. 15% of the cards in my deck are missing their images, which makes them hardly usable. I can send my Logseq graph through PM if it can help resolve those issues.

I think there might be another issue as well then. Can you sent me the logseq block contents which references the image?

Also, what OS are you on?


I added a new commit. Can you try rebuilding it again and sync? NB: Please disable the skip on dependency hash match setting before syncing.

piskel commented 1 year ago

Your changes did the trick! All the images are showing! Thanks a lot!

And I don't know if it's still relevant now, but I'm running Windows 11 Home (Build 22000)

debanjandhar12 commented 1 year ago

Great! NB: I would highly recommend enabling the skip on dependency hash match settings now since its resolved.