• Stars
    star
    176
  • Rank 216,987 (Top 5 %)
  • Language
    Emacs Lisp
  • License
    BSD 3-Clause "New...
  • Created about 4 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sync org notes to Anki via AnkiConnect

org-anki

Non-invasive minor mode to synchronize your org-mode notes to Anki.

Works via AnkiConnect add-on to Anki.[fn:via]

Features deck import via org-anki-import-deck (requires pandoc for converting html to org).

How

Creates “Basic” or “Cloze” type notes.

By default “Basic” cards are created where org entry’s heading is the card front and content is the back.[fn:how] If the heading has Cloze syntax ({{...}}) then the heading is used to create both the question and the answer, and content of the org entry is not used.

Tags are also synchronized.

See example.org and the resulting screenshots for how the cards look after being synced to Anki.

Commands

org-anki-sync-entry
adds or updates the current org-entry under cursor.
org-anki-update-all
updates all entries in buffer. “All” means all entries that have ANKI_NOTE_ID property set.
org-anki-sync-all
adds or updates all entries in buffer. Use #+ANKI_MATCH: some_property=”some value” at top-of-file to selectively sync matched entries. Syntax is same as the MATCH argument for org-map-entries.
org-anki-delete-entry
deletes entry from Anki. Entry must have ANKI_NOTE_ID property.
org-anki-delete-all
delete all entries with ANKI_NOTE_ID property set from Anki.
org-anki-cloze-dwim
converts a region or word under cursor to Cloze syntax, i.e {{c1::hidden text::hint text}}. This should be used in org entry’s title.
org-anki-browse-entry
Browse entry at point on anki’s browser dialog with searching nid
org-anki-import-deck
Prompts for deck name and imports it. Requires pandoc for converting html to org.

Setup

  • Start Anki with AnkiConnect installed
  • Set destination deck name, either as:
    • (customize-set-variable 'org-anki-default-deck "my-target-deck") in your .emacs
    • #+ANKI_DECK: my-target-deck on top of an .org file
    • :ANKI_DECK: my-target-deck in the properties’ drawer of the item
    • Note that deck mentioned in the above ways must pre-exist (it has to be separately created in the Anki app)
  • Run org-anki-sync-entry to sync org entry under cursor Note: the card browser must be closed while synchronizing, as it won’t update the note otherwise (issue).
  • Run org-anki-delete-entry to delete entry under cursor

You probably want to bind org-anki-sync-entry to a key sequence, but not org-anki-delete-entry – as accidentally deleting notes will become too easy.

In any case, don’t forget to create backups, as deleting notes will lose their scheduling information.

Customize

org-anki-ankiconnnect-listen-address
set AnkiConnect’s listen address. Default is http://127.0.0.1:8765.
org-anki-inherit-tags
tag inheritance is on by default. Set this to nil to turn it off.
org-anki-default-note-type
set note type. By default this is =”Basic”=.

Why

.. as there are anki-editor, pamparam, org-drill, org-fc?

Anki-editor requires subheadings for card front and card back, thus existing .org notes need to be modified to be ankified. This package takes the heading as card front and content as card back.

The other three are emacs or org-mode only[fn:others], so no spaced repetition from your phone or web.

Footnotes

[fn:via] AnkiConnect starts a HTTP server on localhost:8765 which the current package talks to.

[fn:how] It does this even if the next heading is a sub-heading (you probably don’t want subheadings in card contents anyway).

[fn:others] I mean, do you really want to use this just to use Anki?? :p