-
Notifications
You must be signed in to change notification settings - Fork 32
Images draft #43
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
base: master
Are you sure you want to change the base?
Images draft #43
Conversation
|
Thanks! I'm short on time this week, but will definitely look into this! |
|
It would be better to use link abbreviations to make it much less painful to change paths. Also, |
|
I looked at the code and have following feedback:
Linking related issue #17 |
|
Thanks for your feedback both of you. I will have more time in a few weeks to look into this. |
949a93b to
099d8ed
Compare
099d8ed to
8f860ee
Compare
|
No problem, its still very much work in progress.
…On Fri, Jun 10, 2022, 10:36 Markus Läll ***@***.***> wrote:
Thanks! I'm short on time this week, but will definitely look into this!
—
Reply to this email directly, view it on GitHub
<#43 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHKQJUIV24SDETSV656QEMDVOL5CLANCNFSM5YA2KBFQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
Is this still being worked on? would be really neat to have image support |
|
This PR is valid, but the |
|
There is a slight issue with the |
|
Is this still being worked on? It would be nice to have proper image export support. This also seems to not handle images from attach: links. attach: links use a short file name, but the full file path can be obtained by using |
|
I won't be working for this in the future unfortunately. I kind of have
my own fork of org-anki that is now too far apart from this code
base. I'll consider publishing it at some point if I find time to clean
it up.
|
|
@theottm Do you mind if I continue work based on your commits? I might have time for this during Christmas holidays. |
|
I personally think a cleaner approach is to send the images using AnkiConnect by populating the "picture" field of the json, but maybe that would not allow images to be placed anywhere within the field, only the end, so if you have multiple images it may not have the intended result (but I don't think I ever made an anki note with multiple pictures). All we need to do is to strip out the attach: or file: link, get the actual file, and send the path to file. This would not automatically allow importing decks, though. |
|
@eyeinsky no, please go ahead, i'd be glad! |
Hi!
I hacked a bit on a solution to integrate images from org into anki notes and vice-versa. It still has a few rough edges and I didn't try it out much yet. But it reached a point where at least for me it seems to work fine. I wanted to share it so other can try it out and comment the code and usage.
The general idea is the following. Media are stored in a special folder under the Anki dir. To sync with AnkiWeb the media need to be there, it seems not possible to use links. So for the direction org->anki we need to copy the images to the media dir of anki. Also we need to strip of the local path before the image name in the org links. For the anki->org direction we can just directly point to the media dir of anki. This is used when importing a deck that already had images.
Concretely I added the following:
org-anki-media-dirwhich points to where anki stores media.org-anki--html-to-orgI wrapped the output string to addorg-anki-media-diras a prefix to all links. This relies onorg-mlfor now, not sure if you want to add this dependency.org-anki--string-to-htmlI wrapped the string to remove the folder from all links. Also relies onorg-mlorg-anki-copy-imageswhich copies all the images from links under the subtree at point (this could be changed) to anki media dir. This also relies on org-ml.What do you think about adding
org-mlas a new dependency? I feel more comfortable using this than direct string insertion.WDYT?