Skip to content
This repository has been archived by the owner on Oct 23, 2021. It is now read-only.

lins05/mn3_anki_fix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This tools may no longer work with the latest version of MarginNote.

This tool was written several years ago, and most likely the format of the apkg file exported by MN has been changed so far.

What is this

Fix the anki cards exported by MarginNote3 (up to 3.4.3). The problems I suffer are:

  • Only one anki card is generated, even if there are multiple clozes.
  • Inconsistent & confusing format of the card front / back for cards w/ clozes in the title and cards w/o.
  • MN tags appear in the back of the anki card.

This script reads the contents of generated apkg file, and makes use of genanki package to rewrite it to a better one.

Visual Comparison

Original apkg imported into Anki

  • title shown in bottom
  • only one card for 3 clozes
  • tag is shown in the back card

Improved apkg imported into Anki

Limitations

  1. All existing MN3 anki cards must be deleted from anki first. Otherwise the import would fail.
  2. Cards with images/videos/audios are not supported.

How to use

  1. Make sure python3 is installed on your Mac.
  2. Install the requirements
    pip3 install -r requirements.txt
  1. Run the script to fix the exported apkg file before importing them to anki.
./fix_mn_anki_exports.py fix /path/to/apkg

You'll see output like this:

[09/14/2019 23:00:47][fix_mn_anki_exports]: Auto located apkg file /path/to/apkg
[09/14/2019 23:00:47][fix_mn_anki_exports]: files: ['collection.anki2', 'media']
[09/14/2019 23:00:47][fix_mn_anki_exports]: Extracted collection.anki2 to /tmp/mn-anki-exports-fix/tmprjqntj9e
[09/14/2019 23:00:47][fix_mn_anki_exports]: Loaded the model
[09/14/2019 23:00:47][fix_mn_anki_exports]: Loaded 45 notes
[09/14/2019 23:00:47][fix_mn_anki_exports]: Fixed all 45 notes
[09/14/2019 23:00:47][fix_mn_anki_exports]: Loaded deck info: deck name = 20181501542376, id = mydeck
[09/14/2019 23:00:47][fix_mn_anki_exports]: Generating output file /tmp/output.apkg

The improved apkg would be /tmp/output.apkg.

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published