Skip to content

taurgal/ox-ankieditor

Repository files navigation

ox-ankieditor – Org mode exporter to anki based on anki-editor

Installation

Requirements

  • anki-connect, An Anki add-on required by this package to interact with Anki.
  • anki-editor (this dependance shall eventually be removed)
  • curl Utility used for socket communication.

Usage

The Layout of Notes

Since this exporter is derived from the standard html exporter it should support all the nice features of org-mode.

The structure of a note is the same as that of anki-editor which is itself inspired by org-drill. More examples can be found in examples.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
  • An Anki note is an Org entry with a ANKI_NOTE_TYPE property.
  • Anki tags can be set in two ways
    1. With “ANKI_TAGS” property, multiple tags are seperated with space
    2. With Org tags [fn:1], this could be turned off if you would like to keep Org tags separated from Anki tags
  • Other necessary information (e.g. deck, note type) of a note is put in the property drawer of the entry
    • the ANKI_DECK property is retrieved with inheritance so you don’t have to set it per note. For example you could
      • create a deck entry with this property set and put note entries under it;
      • or set it as a global property by inserting #+PROPERTY: ANKI_DECK YourDeck near the top of the file.
  • Child entries of a note entry are fields. More precisely
    • The field name is retrieved from the entry title
    • It is an error if the entry title it not a field name

Commands

CommandBrief Description
anki-editor-push-notesPush notes to Anki. Additional arguments can be used to restrict the range of notes.
anki-editor-retry-failure-notesSame as above, except that it only pushes notes that have ANKI_FAILURE_REASON.
anki-editor-insert-noteInsert a note entry like M-RET, interactively.
anki-editor-cloze-regionCreate a cloze deletion from region.
anki-editor-export-subtree-to-htmlExport the subtree at point to HTML.
anki-editor-convert-region-to-htmlConvert and replace region to HTML.

Functions

NameDescription
anki-editor-map-note-entriesSimple wrapper that calls org-map-entries.
anki-editor-note-at-pointConstruct an alist representing a note from current entry.

Variables

NameDefault ValueDescription
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-latexnilIf non-nil, consecutive `}’ will be automatically separated by spaces to prevent early-closing of cloze.
anki-editor-create-decksnilIf 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-tagstIf 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.

Limitations

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.

About

Org-mode exporter to anki base on ani-editor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published