🎓 Create Anki Cards from Markdown Files
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
FoxMaSk 0f95ed99c6 upd repo 3 months ago
baeuda upd repo 4 months ago
.gitignore Initial commit 4 years ago
.gitlab-ci.yml pytest tox 2 years ago
LICENSE doc 1 year ago
MANIFEST.in update with last joplin api 4 years ago
README.md upd repo 4 months ago
VERSION.txt doc 1 year ago
anki_card.png en images 4 years ago
anki_deck.png en images 4 years ago
anki_integration.png en images 4 years ago
anki_list_decks.png en images 4 years ago
requirements-dev.txt simplifying 2 years ago
requirements.txt upd repo 3 months ago
setup.cfg upd repo 4 months ago
setup.py update with last joplin api 4 years ago
tox.ini pytest tox 2 years ago

README.md

배우다 - Beauda - Learn - Apprendre

This script 'baeuda', allow to get the content of markdown file tables and add that content to Anki cards in deck(s)

📦 Installation

pandoc is required on you system to allow to convert html content into markdown

Requirements

  • python 3.8+
  • httpx
  • pypandoc
  • beautifulsoup4

Install the project

create a virtualenv

python3.8 -m venv baeuda
cd baeuda
source bin/activate

clone the project

git clone https://git.afpy.org/foxmask/baeuda
cd baeuda

or

pip install baeuda

Settings

edit settings.py

FOLDER = '/home/foxmask/MyNotes/Kimchi!'   # from which folder does baeuda read the notes to create into anki ?
PYPANDOC_MARKDOWN = 'markdown_github'
FILTER = ''
ANKI_URL = 'http://localhost:8765/'   # url provided by AnkiConnect https://ankiweb.net/shared/info/2055492159
ANKI_MODEL = 'Korean (foxmask)'  # the name of the model you create in Anki desktop, or the standard one you duplicate
ANKI_FIELD_COUNT = 3   # number of columns to grab from a markdown table
ANKI_FIELDS = ['Coréen', 'Romanisation', 'Français']  # put the name of the fields you want to use with the "ANKI_MODEL"
ANKI_DECK = 'Korean Courses'

📀 DataSource

Markdown files

The name of the file should have to be that way:

foobar - xxx - yyy.md

for example

Kimchi! 01 - insa - 인사.md

Baeuda will create note with xxx and yyy as tag in anki. In our example : insa and 인사

Format of notes for Anki

To process, all the markdown files should have, at least, those content structure:

  • h1 with the title of your markdown file
  • h2 with tags name (optional)
  • table with same headers name of the "fields" defined in the "anki type of note"

Let's see with an example :

In anki, among the provided types of notes, you can find "basic" which content 2 fields "recto" and "verso"

so in your markdown file you will have to create tables with headers named recto and verso

Title of the note - Topic - details

Recto | Verso 
-------- | --------
Color on the sun ? | Yellow
Universal reply ? | 42

real example with three columns

Kimchi! Fiche 1 - 인사 - insa - salutations
Coréen | Romanisation | Français
------ | ------------ | --------
안녕하세요 | annyeonghaseyo | bonjour

Anki desktop

To add cards to Anki, you need to use an existing model (also known as "type of notes")

There are many models you can use, if none fit your needs, you can create on as I did : tools > type of notes then add button and choose Duplicate Basic (and reversed card) then we'll add a third fields Romanisation and will change Front to Coreen and Back to Français

Then add this addon AnkiConnect to allow Anki to allow us to add the notes with the current script.

Let's Go

First of all, start Anki on your desktop

simulated process

python baeuda/run.py -a report

will display a table of all the grabbed data to create card

creating cards

python baeuda/run.py -a go

during the execution, you can have a look in anki and see the decks created and receiving cards ;)

From Markdown file to Anki in images

  1. baeuda running in the console

Anki integration

  1. Anki with the new created decks

Anki Decks List

  1. the cards of the deck

Anki The Deck

  1. one card

Anki The card

(Image credits to Emojipedia)