Formatting - eevdriet/obsidian-anki GitHub Wiki
To make sure that notes that are defined in Obsidian look alike in Anki, they are formatted to be valid HTML.
Obsidian allows for HTML within its Markdown files, so only Markdown specific elements are formatted before exporting.
Conversely, all HTML tags that have a Markdown counterpart are formatted into Markdown before importing.
This page highlights the various forms of formatting that are used when syncing notes between Obsidian and Anki.
In Anki, you can create multiple cards for a Cloze
note by using so called cloze deletions.
For example, the following note creates 3 separate cards:
The first three planets in our solar system are {{c1::Mercury}}, {{c2::Venus}}, and {{c3::Earth}}
Exporting your cloze notes from Obsidian is analogous to defining them directly in Anki, make sure to
- Set the note type of your export rule to
Cloze
- Use
{{c<n>::<text>}}
deletions in your note, where-
<n>
is the cloze number -
<text>
is the text to cloze
-
To work with media files in both Obsidian and Anki, you need to
- Specify an attachment location where the media file resides
- Reference the file in your notes
In Anki, all media files are stored in the collection.media
folder.
You can attach media to your notes by clicking the Attach pictures/audio/video (F3) button when adding the note.
In Obsidian, you can specify where to store your attachments with the Default location for new attachments setting.
You can attach media to your notes by embedding the media file directly in the note with ![[...]]
:
el agua -> the water #flashcard/spanish
Sound: ![[el agua.mp3]]
ObsidianAnki allows for syncing media files between Obsidian Anki by converting the formats and storing the actual media files.
When the media is given as a file embed in Obsidian, it is formatted into the right HTML tag in Anki.
Conversely, all media tags in Anki are formatted into embeds in Obsidian.
Note that you can also specify your media as HTML in Obsidian, in which case no formatting takes place.
Markdown | HTML |
![[audio.mp3]] |
[sound:audio.mp3] |
![[image.mp3]] |
<img src="image.mp3"> |
![[video.mp4]] |
<video controls>
<source src="video.mp4" type="video/mp4">
</video> |
Both Obsidian and Anki support LaTeX to typeset mathematical expressions.
One caveat is that Anki exclusively uses \(...\)
and \[...\]
whereas Obsidian also allows $...$
and $$...$$
to define equations.
Therefore $...$
and $$...$$
are translated on export but \(...\)
and \[...\]
are kept the same between both applications.
From | To |
---|---|
$...$ |
\(...\) |
$$...$$ |
\[...\] |