I made a script to convert notes to anki cards

Hey everyone, I made a script that allows notes to be converted to Anki cards. On subsequent runs, the script updates the cards as well. Take a look here to get started:

9 Likes

thanks hopefully we can integrate this more once we have plugins!

Any idea when the macOS will come out?

Most likely next week. Just need to make sure it can find the right anki profile folder for copying images over

1 Like

Great !!! Many thanks in advance.

Thank you very much, I tried, but it doesn’t display the code correctly.

Can you send me the original markdown with the code? I usually don’t have code in my markdown.

OK,here is my markdowntest.zip (233 Bytes)

Was this working before? Seems the conversion from md to html was correct, but Anki may be having trouble formatting the code. There’s an Anki add on that can format code blocks: https://ankiweb.net/shared/info/162313389

the conversion from md to html was wrong :anguished:


and the source code of html was like this

I see what you are saying. This happened because every new line in the html becomes a card. If we space the code properly on individual lines, it would not render the cards at all when you import it to Anki. I don’t have a proper solution for that right now.

I just don’t know if there would be anyway around that. Anki’s default import html uses every line as its own card. I don’t know if there’s anyway around it, with the script or not.

1 Like

Does this mean that every note / line in a note should correspond to an Anki card? For me the bridge between notes and anki cards is of interest, but my notes are conceptual descriptions, whereas for anki cards I’d want questions derived from those notes. So not a 1:1 match between notes and an anki card.
A note could also mean several questions about the same thing, just from a different angle, so not a 1:1 relationship between 1 note and 1 anki question either.

A wonder if my Anki questions might be better of as metadata for a note. E.g. in its YAML front matter?