-
Notifications
You must be signed in to change notification settings - Fork 1
Quick Start
Learning to use in an instant.
Installing via PyPI is highly recommended.
pip install AnkiIn
Anki Connect is required to be installed for exporting functions.
Anki Extention Code: 2055492159
For more detailed installation guide, please visit anki-connect repo.
There are three major parts of the lib:
- helper, including AnkiConnect Helper, Genanki Helper, and so on.
- notetypes, some built-in note types for generating cards. Third-party note types can be dynamically loaded.
- parser, handle different formats and generate cards. For now, only the markdown is supported.
And here are abstractions:
- model, properties concerning note types, for example, fields and display styles.
- note, which would generate several cards.
The other less important parts are log, config and note type loader, etc.
When parsing, the parser will pass the text to different note-type parsers.
They will check if the text should be recognized as a specific note type and then generate a note object.
This is a question.
This is an answer.
Single line question.
Multiple line answer.
The first line of this block is recognized as the question.
Multiple line question is <br> possible somehow.
too hacky maybe.
markdown rendering is supported.
- use a list!
- or something like that.
Clozes are **easy** to **create** too.
If you want to generate a list of cards from an entire file, you should operate like this:
from AnkiIn.parser.markdown import handle_post
handle_post(text) # A list of notes will be returned
And if you want a single note, use:
from AnkiIn.parser.markdown import get_note
get_note(text)
Now there are two methods to export notes to Anki:
- Anki connect: directly add cards to Anki profile, require Anki in the background.
- Genanki: directly generate
apkg
files.
If you want to use anki connect, please first check whether Anki is running:
from AnkiIn.helper.ankiConnectHelper import check_online
if not check_online():
print("Not Connected!")
Then, exporting notes are simple:
from AnkiIn.helper.ankiConnectHelper import add_notes
add_notes(note_list)
For Genanki, you can skip the online checking process.
from AnkiIn.helper.genankiHelper import export_notes
export_notes(note_list, file_path)