louietan / anki-editor

Emacs minor mode for making Anki cards with Org
707 stars 87 forks source link
anki emacs flashcards org-mode

[[http://melpa.org/#/anki-editor][file:http://melpa.org/packages/anki-editor-badge.svg]]

anki-editor -- Emacs minor mode for making Anki cards with Org

/Since I'm not a native English speaker, feel free to correct me if there were any ambiguity or grammatical mistakes ;-)/

** The Layout of Notes

Now you can compose Anki notes in Org syntax, e.g. lists, code examples, tables, embedded latex, when being submitted to Anki, they will be converted to HTML by Org-mode's HTML backend with specific markers (e.g. latex) translated to Anki style.

The structure of a note is as follow, which is inspired by =org-drill=. More examples can be found in [[./examples.org][examples.org]].

+BEGIN_SRC org

 ,* Idiom                                                        :vocab:idioms:
   :PROPERTIES:
   :ANKI_DECK: English
   :ANKI_NOTE_TYPE: Basic (and reversed card)
   :ANKI_TAGS: languages european_languages
   :END:
 ,** Front
    (it's) raining cats and dogs
 ,** Back
    it's raining very hard

+END_SRC

** Commands

| Command | Brief Description | |------------------------------------+--------------------------------------------------------------------------------------| | anki-editor-push-notes | Push notes to Anki. Additional arguments can be used to restrict the range of notes. | | anki-editor-retry-failure-notes | Same as above, except that it only pushes notes that have =ANKI_FAILURE_REASON=. | | anki-editor-insert-note | Insert a note entry like =M-RET=, interactively. | | anki-editor-cloze-region | Create a cloze deletion from region. | | anki-editor-export-subtree-to-html | Export the subtree at point to HTML. | | anki-editor-convert-region-to-html | Convert and replace region to HTML. |

** Functions

| Name | Description | |------------------------------+------------------------------------------------------------| | anki-editor-map-note-entries | Simple wrapper that calls =org-map-entries=. | | anki-editor-note-at-point | Construct an alist representing a note from current entry. |

** Variables

| Name | Default Value | Description | |-----------------------------------------------+------------------------+----------------------------------------------------------------------------------------------------------| | anki-editor-anki-connect-listening-address | "127.0.0.1" | The network address AnkiConnect is listening. | | anki-editor-anki-connect-listening-port | "8765" | The port number AnkiConnect is listening. | | anki-editor-break-consecutive-braces-in-latex | nil | If non-nil, consecutive `}' will be automatically separated by spaces to prevent early-closing of cloze. | | anki-editor-create-decks | nil | If non-nil, creates deck before creating a note. | | anki-editor-ignored-org-tags | '("export" "noexport") | A list of Org tags that are ignored when constructing notes form entries. | | anki-editor-org-tags-as-anki-tags | t | If nil, tags of entries wont't be counted as Anki tags. | | anki-editor-protected-tags | '("marked" "leech") | A list of tags that won't be deleted from Anki even though they're absent in Org entries. |

** Tags between Anki and Org

Because the set of characters allowed in tags is different between Anki and Org, you have to make sure that tags from Anki are compatible with Org and tags in Org could be recognized by Anki.

** Working with Anki add-ons

This package may not work well when you are using certain Anki add-ons especially those who extend the builtin Anki note editor to automatically fill note field content (e.g. ~Add note id~).

[fn:1] It should be noted that Org only allows letters, numbers, =_= and =@= in a tag but Anki allows more, so you may have to edit you Anki tags before they can be used in Org without any surprise.