In Mochi, imports use the format .mochi. These are zip files that contain the following files:
- data.edn or data.json
- Any number of media files
The data.edn or data.json file contains information about the decks and cards to be imported. If using JSON, the file should be encoded with Transit semantics. For EDN, more information can be found here: Extensible Data Notation. The JSON format is recommended for large data sets due to the improved speed when importing. A sample data file might look like this:
:parent-id - An :id of another Deck. If provided, this deck will be nested under the parent deck in the sidebar.
Template
Required
:id - A keyword. (0-9A-Za-z) Should be globally unique, at least 8 characters.
:name - A string.
Optional
:id - A keyword. (0-9A-Za-z) Should be globally unique, at least 8 characters.
:content - A string. The actual mustache-enabled content of the template.
:fields - A map of Fields. At least one field needs to have a an ID of :name, which will act as the primary field for cards using this template and is used to represent them in parts of the UI.
:pos - A string. /[0-9A-Za-z]+/ The order that this template will be displayed in the template window. Templates are sorted lexicographically.
Field
Required
:id - A keyword. (0-9A-Za-z) Should be unique within a template, at least 8 characters.
:name - A string.
Optional
:type - A keyword. One of :text, :boolean, :speech, :image, :translate, :dictionary
:pos - A string. /[0-9A-Za-z]+/ The order that this field will be displayed. Fields are sorted lexicographically.
:options - A map of keywords to values. This field is only applicable for certain values of :type.
:lang - A string; language code; used for the :speech type. See Custom Components.
:from - A string; language code; used for the :translate and :dictionary field types.
:to - A string; language code; used for the :translate and :dictionary field types.
:boolean-default - A boolean. Used as a default value for the :boolean field type (checkbox).
NOTE: This is only necessary for cards in the top level :cards vector.
Optional
:id - A keyword. (0-9A-Za-z) Should be globally unique, at least 8 characters.
:name - A string. The name will show up when linking to this Card from markdown, as well as in other parts of the UI.
:pos - A string. /[0-9A-Za-z]+/ The order that this card will be displayed, relative to others in the deck page, as well as during learning. The cards will be sorted lexicographically.