When I created Mochi over 2 years ago, I wanted a simple and minimal way to create flashcards from markdown notes. I think Mochi accomplishes that goal pretty well, but there are times when writing markdown for each card can get pretty tedious. Most notably with language cards, I found myself repeating the same format for most of my cards. This is where templates come in. It allows you to define the structure of your cards once in markdown, then just fill in the variable data with custom fields on the card.
To create a template, click the three dots on the deck page and select "Templates."
From there you can create a new template, or use an existing one. When you create a template, you'll have the option of adding additional fields. Each template must have at least one field (the primary field), which is used as the "title" of the card. The title of the card will be used in various parts of the Mochi UI, such as search results or references. If I was making a template for vocab words, I would probably make the primary field the vocab word itself.
Once you've added your fields, you can start using them in your template. You can inject the value of a a field in your template using this syntax:
<< My field >>.
So far we've just talked about flash cards, but the utility of templates isn't limited to flash cards. You could also use them to format your notes. For example if you are using the zettelkasten method, you might create a template like this:
# << Title >> --- << Tags >> << Body >> << References >>
Although it would be easy enough to write this out as plain markdown, the beauty of templates is that it lets you re-arrange the elements without having to re-write all of your cards.
There are a few things I'm planning to add to templates in the future.
- Custom elements. These would allow you to do things like generate audio files, color code tonality in Chinese words, or add furigana (other suggestions welcome!).
- Built in fields. Built in fields would be things like
<< Created at >>and other metadata about the card.
- Using fields outside of templates. Using custom elements and fields outside of templates would also be useful.
- Default cards. This would be similar to how templating works in other note taking systems, where each card would just have some default text that you could modify freely.