from Hacker News

Show HN: Generate Anki cards from your notes

by ichverstehe on 10/31/22, 7:52 AM with 0 comments

Hi!

To help me prepare for a biology test, I made a Python app, using the excellent genanki package[1] to generate Anki cards directly from my Markdown notes. Cards are created from list items, using delimeters like `?::` to separate the question/answer (or front/back) from one another.

Example:

---

# The Solar System

- Number of planets ?:: 8

## Planets

- Mars

  - Color ?:: red
---

This will create two cards:

(1)

Path: The Solar System

Front: Number of planets

Back: 8

(2)

Path: The Solar System > Planets > Mars

Front: Color

Back: Red

Other tools to generate Anki cards from Markdown exist, but none worked well with nested lists. I also really wanted to have a "path", generated from headings/ancestral list items, to enable very succint cards, such as the `Color ?:: red`.

I hope it might be of use to someone else.

[1] https://github.com/kerrickstaley/genanki