Advanced formatting

In addition to standard markdown formatting, Mochi also supports more advanced and non-standard formatting including mochi-specific features.

Flashcard sides

Use three dashes (---) to separate a card into "sides" that can be revealed when reviewing.

Front
---
Back

Hidden text (Cloze deletions)

Cloze deletions are a way of hiding information within a card when it's being reviewed.

Simple deletions

Mochi supports simple cloze deletions with the following markdown syntax:

The Shiba Inu is a breed of {{hunting dog}} from {{Japan}}.

Where both "hunting dog" and "Japan" will be hidden when the card is reviewed.

Cloze deletion groups

You can also prefix an index number to your cloze deletions to create separate cloze groups for your card, one for each index, where only one cloze group will be hidden at a time. For example:

The {{1::Shiba Inu}} is a breed of {{2::hunting dog}} from {{2::Japan}}.

In this example, you will be shown two different versions of the card, one where "Shiba Inu" is hidden, and one where "hunting dog" and "Japan" are hidden. These two versions will have their own review shedule and history.

Typing in cloze deletions

You can display cloze deletions as input fields and test your knowledge by typing in the answer. To display cloze deletions as typable inputs, go to Settings -> Preferences -> Cards and turn on "Type hidden text". This setting can also be enabled on a per-deck basis by going to the "Deck preferences" on a deck page.

References and Embeds

Mochi supports MediaWiki-style links for referencing and embedding other cards, decks, fields, and attachments.

  • [[card-id]] Link to a card using its ID. The title is taken from the card’s name.

  • [[Title|card-id]] Link to a card with a custom label.

  • [[Card name]] Link using the card’s name. Mochi will resolve it to the correct ID automatically.


Embeds

Use ![[ ... ]] to embed content directly inside a card.

  • ![[card-id]] Embed the entire card (no border).

  • ![[card-id/1]] Embed a specific side (side 1 in this example).

  • ![[card-id/attachment.jpg]] Embed an attachment stored on another card.

  • ![[card-id/field-id]] Embed the value of a specific field. (Field IDs can be copied from the template editor.)

  • ![[card-id:embed]] Embed the entire card with a border. (Legacy format.)


Self-embeds

You can embed content from the current card using self:

  • ![[self/1]] — Embed side 1 of the current card
  • ![[self/deck]] — Embed the current card’s deck name
  • ![[self/path]] — Embed the full deck hierarchy path

These are mostly only useful inside templates.

Attachments

Media can be attached by dragging and dropping a file onto the editing area, or pasting an image that's been copied to the clipboard. The media will be stored locally and displayed using standard markdown syntax.

![Some Image](image-name.jpg)

The above syntax will work for audio and video files as well. If the card is deleted, the associate media will also be deleted.

For images, you can adjust the dimensions by adding |800x600 to the image title. The first number will be the width, and the second number the height. If you exclude the height, the image will resize proportionally.

![Some Image|800x600](image-name.jpg)
![Some Image|800](image-name.jpg)

Ruby / Furigana / Pinyin

Some languages (like Chinese or Japanese) which have words that cannot be read phonetically, so it is useful to annotate them with phonetic readings. You can accomplish this using the following syntax:

{持}(も)ち

Math / LaTeX

Mochi supports rendering mathematical expressions using KaTeX, a fast LaTeX math renderer.

You can write LaTeX in two ways:

Inline expressions

Use single dollar signs:

The area is given by $A = \pi r^2$.

Display (block) mode

Use double dollar signs for centered, full-width equations:

$$
\int_0^\infty e^{-x^2} \, dx = \frac{\sqrt{\pi}}{2}
$$

You can add globally accessible LaTeX macros in Settigns -> Editing -> Latex macros.

HTML

If markdown isn't enough, you can also add HTML to your cards. For example, to change the color of a word you can write: <span style="color:red">foo</span> which will look like this: foo.

Note

Markdown will not be rendered inside of HTML tags.

Dynamic Elements

Like other markdown renderers, Mochi can render a subset of HTML within your cards. Mochi also comes equipped with some custom HTML elements that provide additional functionality.

<input>

Creates a text box for typing an answer. The typed answer will be checked against the value of the value attribute.

Attributes:

  • value - String - The value to check the typed answer against. You can provide multiple variants by separating them with a pipe (|) character. To require multiple correct answers, you can separate them with an ampersand (&).

  • type - String - "text" | "number"

  • inline - Boolean - Whether the input should appear inline within a line of text, or on a new line by iteself.

Example:

The capital of France is <input value="Paris" inline>.
A type of pastry made from leavened fried dough:
<input value="donut|doughnut">
Flu symptoms:
<input value="fever & cough & fatigue & sore throat & headache">

<draw>

Creates a drawable canvas on the card. The size of the canvas can be set using the width and height properties. Accepts the following attributes:

Attributes:

  • brushRadius - Integer - The size of the brush.

  • brushColor - CSS <color> - The color of the brush.

  • width - CSS <length> - The width of the canvas.

  • height - CSS <length> - The height of the canvas.

Example:

<draw height="200px" brushColor="#FF0000" brushRadius="4"/>

<furigana>

This component will add phonetic hiragana above above Japanese kanji. The text can contain a mixture of kanji, hiragan, and katakana, but should have at least one kanji character to function properly. The mode attribute can be one of normal, spaced, okurigana, or furigana. Defaults to okurigana. The to attribute can be one of hiragana, katakana, or romaji. Defaults to hiragana.

Example:

<furigana>例えば</furigana>

<pinyin>

This component displays Pinyin romanization above chinese characters, including tone denoting diacritic marks.

Example:

<pinyin>中心</pinyin>