anki-editor/README.org
2018-06-10 22:19:34 +08:00

71 lines
3.2 KiB
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
* Installation
*Requirements*
- [[https://github.com/FooSoft/anki-connect#installation][anki-connect]],
an Anki add-on required by this package to interact with Anki.
- curl
If you have [[http://melpa.org/][MELPA]] in your =package-archives=,
just =M-x package-install RET anki-editor RET=, or install it
manually by downloading and visiting [[./anki-editor.el][anki-editor.el]] in your
emacs buffer, and =M-x package-install-from-buffer RET=.
* Usage
** 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)
:END:
,** Front
(it's) raining cats and dogs
,** Back
it's raining very hard
#+END_SRC
- An Anki note is an Org entry with =ANKI_NOTE_TYPE= property
- Anki tags are just Org tags [fn:1]
- Other necessary information (e.g. deck, note type) of a note is
put in the property drawer of the entry
- As the value of =ANKI_DECK= is retrieved with inheritance, you
don't have to set it per note, instead, you could create a deck
entry with this property set and put note entries under it, or
set it per file by ~#+PROPERTY: ANKI_DECK YourDeck~
- Child entries of a note entry are fields
** 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. |
*Since I'm not a native English speaker, let me know if there's any ambiguity or grammatical mistakes.*
* Demo
[[./demo.gif]]
[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.