louietan / anki-editor

Emacs minor mode for making Anki cards with Org
699 stars 87 forks source link

org-babel, org-html export and exported figures #58

Closed leoc closed 4 years ago

leoc commented 4 years ago

Hoi there!

Thank you for your beautiful package! I was just wondering whether you thought or tried exporting images from code blogs via org-babel?

I often use graphviz code, PlantUML, DITAA or similar. Have you tried these?

For example I try the following org-mode code to generate a graph, but the image is not displayed or pushed to anki.

#+BEGIN_SRC dot :file test-dot.png :exports results
graph {
  a -> b
}
#+END_SRC

Have you played with that in the past? I will try to investigate a bit later this week, but maybe you have a quick hint. Thanks again!

leoc commented 4 years ago

Hey I tried again for a while. Now, after fixing the graph, it works. But when I change the graph the image is not updated. Only when I change the :file name to another value the update is pushed to anki.

Do you have an idea why? I see that anki-editor should generate a hash and adjust the media accordingly.

louietan commented 4 years ago

Oops, we introduced a bug when replacing the shell command sha1sum with Elisp function, which mistakenly compute the hash against the file name rather than the file content. I made a patch on develop branch, it should work now.

leoc commented 4 years ago

Hah! I looked for the bug but totally overlooked that! Thanks!