A command line program to convert markdown files into anki decks.
Project description
markdown-anki-decks
Markdown anki decks is a simple program to convert markdown files into anki decks.
# The h1 tag is the deck title
## The h2 tags are the questions
The markdown content between h2 tags are the answers.
Markdown anki decks uses the question to uniquely identify the card. You can change the card contents without losing your progress on the card. Markdown anki decks can be reimported without creating duplicates.
Installation
Make sure you have a python version of 3.7 or greater installed.
pip install markdown-anki-decks
This will install the mdankideck
cli tool.
Usage
Run mdankideck input output
to convert the markdown files in the input directory to apkg
files in the output directory.
Tutorial
Markdown anki decks converts all markdown files in an input directory to apkg
files.
The apkg
files are stored in an output directory.
-
Create the input directory
mkdir input
. -
Create the output directory
mkdir output
. -
Create a markdown file in the input directory.
<!-- input/deck.md --> # Deck Title ## Card Title card contents. ## Second Card Title card contents 2.
-
Run
mdankideck input output
to convert the markdown files in the input directory toapkg
files in the output directory. -
Import
apkg
files as decks into anki.
Images
Markdown anki decks support images which are stored in the same folder as the markdown file they are referenced by.
![my-image](image.jpg)
will work because it is in the same folder as the markdown file.
![my-image](./images/image.jpg)
will not work because it is in a different folder than the markdown file.
All images must have unique filenames even if they are stored in different folders.
These are limitations of anki not Markdown anki decks.
Questions
All questions in a single deck must be unique. Two questions in the same deck which are identical will have the same id and will lead to a collision.
Design
The markdown files are parsed with commonmark. The resulting html is then parsed with beautifulsoup. Finally the cards are created with genanki. The cli is implemented using typer and the program is packaged using poetry.
Contributing
Happy to discuss additional features if you open up an issue.
We use commitizen for commits.
Run poetry run cz commit
to make a commit.
Releases
Run poetry run cz bump --check-consistency
to update the changelog and create a tag.
Create the build with poetry build
.
Publish the build with poetry publish
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for markdown-anki-decks-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8209b77e36ba7915b9699fd313dbf6cdda304918f9408d41674fc8853c261a57 |
|
MD5 | e024a0279439668b9158288f5fb284dc |
|
BLAKE2b-256 | 00e38a5d2ce5304cb2af77b2c322e5572b13128b61b62efcd39a110af27e0245 |
Hashes for markdown_anki_decks-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd8658275911abb12461b5138bb7bb4d3b664d342077b90cc46af8cbad94fd9e |
|
MD5 | 18ded828fb0debb7354b3933216c9933 |
|
BLAKE2b-256 | 8030286ad22e193eefda6977d0b5214cc8b9512d8d904a12a5d6c39b40b0b6fd |