AnkiApp

How to import AnkiApp decks (.zip, .xml)

File format

An AnkiApp deck for import can be a valid .xml file (.xml extension with any name) or a zip file with .zip extension (any name) that at least includes a single valid deck .xml file (and optional blobs). The deck xml format will be described below.



Deck XML schema



Header

The deck header includes a <deck> tag with attribute name for the name of the deck with optional parameter tags for deck tags to be added (comma separated).

<deck name="French Translation Deck" tags="deck_tag_1,deck_tag_2">

Deck Fields

Next, we include the field configuration for the deck. In this example, we will have two fields, one for a manually inputted English word, and one field that automatically translates to French, using the English field as the source:

    <fields>
        <text lang="en-US" name="English text" sides="11">
        </text>
        <text lang="fr-FR" name="French translation" sides="01">
            <sources>
                <translation>
                    <ref name="English text" />
                </translation>
            </sources>
        </text>
    </fields>



Sources and reference tags

For a text field type, sources can be defined that feed or populate the text field. For example, a translation field can feed a translated value FROM a source field (see the example above). To define a reference field, use a tag with attribute "name" that is the name of the source field.

Deck Cards

Finally, we include the card data for the deck. Note that imported decks can have cards manually added after import, so the import does not have to be exhaustive.

    <cards>
        <card>
            <field name="Text">
                Hello
            </field>
            <field name="Translation">
            		Bonjour
            </field>
        </card>
    </cards>

Card Tags

To add tags to cards, add the "tags" attribute and set the value as a comma separated list of tag names:

        <card tags="tag1,tag2">
            <field name="Front">Hello</field>
            <field name="Back">Goodbye</field>
        </card>

Closing tag

We complete the deck with a closing tag. Our full example is below:

<deck name="French Translation Deck">
    <fields>
        <text lang="en-US" name="Text" sides="11">
        </text>
        <text lang="fr-FR" name="Translation" sides="01">
            <sources>
                <translation>
                    <ref name="Text">
                    </ref>
                </translation>
            </sources>
        </text>
    </fields>
    <cards>
        <card>
            <field name="Text">
                Hello
            </field>
            <field name="Translation">
            		Bonjour
            </field>
        </card>
    </cards>
</deck>



Deck field specification

The full deck field specification is as follows:

+-------------+-------------+----------------------------------------------+-----------------------------------------------------+
| Type        | Tag         | Example Header                               | Example Value                                       |
+-------------+-------------+----------------------------------------------+-----------------------------------------------------+
| TTS         | tts         | <tts lang="en-US" rate={0.8} />              | <tts lang="en-US">text to speak</tts>               |
| Text        | text        | <text lang="en-US" />                        | Whatever plain text                                 |
| Rich Text   | rich-text   | <rich-text lang="en-US" />                   | <rich-text lang="en-US">Be <b>bold</b>.</rich-text> |
| Markdown    | markdown    | <markdown />                                 | <markdown># Be ahead</markdown>                     |
| Code        | code        | <code lang="javascript" />                   | <code>null == undefined == true</code>              |
| TeX         | tex         | <tex />                                      | <tex>x^2</tex >                                     |
| Audio       | audio       | <audio />                                    | <audio id="{SHA_256 hash of file}" />               |
| Image       | img         | <img />                                      | <img id="{SHA_256 hash of file}" />                 |
| Video       | video       | <video />                                    | <video id="{SHA_256 hash of file}" />               |
| Japanese    | japanese    | <japanese furigana="hint|always|back|off" /> | <japanese>こんにちは</japanese>                       |
| Translation | translation | <translation />                              | <text lang="en-US">Good morning.</text>             |
| Chinese     | chinese     | <chinese pinyin="hint|always|back|off" />    | <chinese lang="zh-CN">你好</chinese>                 |
+-------------+-------------+------------------------------------------------------------------+---------------------------------+

Note that for audio, image, and video tags, there must be an "id" parameter with the value set to the base 16 SHA256 hash of the blob. Additionally, all the files must be placed in the zip file "blobs" directory. They can have any file name.