Convert markdown documents to anki flashcards with this simple python script.
Powered by python-markdown2 and genanki.
- Include images
- Markdown image size specifiers
- Tables
- All the basic markdown syntax
- Style flashcards with CSS
python md2anki.py .\example\example.md
Other:
usage: md2anki.py [-h] [-o OUTPUT] [-s STYLE] INPUT
Convert markdown to anki deck.
positional arguments:
INPUT Input *.md path.
optional arguments:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
Output *.apkg path.
-s STYLE, --style STYLE
CSS card style path.
-q, --questions Create *_questions.md with stripped answers.
-w, --web Create *.html document.
md2anki
depends on markdown2
and genanki
.
pip install genanki
pip install markdown2
Turn this:
# Deck name
## Sub deck 1
### A card question?
An answer!
### Another card question?
Another answer... _With an image!_
![](img/image.png)
## Sub deck 2
### Can you use tables?
- Yes!
| This is | a | table |
|---------|----|----------|
| This | is | great! |
| This | is | amazing! |
| This | is | ok! |
Into this:
More examples in the example/
directory of this repository.
CSS can be added using the -s PATH/TO/STYLE.css
parameter.
CSS with the filename style.css
in the same folder as the markdown file will be applied automatically.
Most markdown CSS should work as expected. For example this github markdown.
I created this for personal use, the code is quite messy but works well. Only tested under windows. Feel free to send me PRs or questions.