I created a quick way to make flashcards and vocab notes for my Japanese learning. I had been struggling with how slow making Anki cards can be and found myself more likely to actually review cards if they were all in Obisidian, which I always have open, rather than opening Anki.
- Templater
- QuickAdd
- Spaced Repetition
- Dataview
- Supercharged Links (Optional)
I am by no means a Templater wizard but managed to trial and error my way into getting the Javascript stuff working.
Everything within the <%* %> sections is pretty much just saying "if X field doesn't exist, prompt for the value of X field then put a Dataview field in front of it." It will output field:: value inputed in prompt At any point you can rename the title of each prompt by changing the value in quotation marks of tp.system.prompt(" ") in the template. You can also add new fields and prompts by copying an existing one:
<%*
let example = tp.frontmatter.example
if (example = "undefined") {
example = await tp.system.prompt("Example");
}
tR += "example::"
%> <%* tR += example %>
and replacing all the instances of the word that occurs after let with a new value. In the above example you would replace example with a new field, e.g. potato:
<%*
let potato = tp.frontmatter.potato
if (potato = "undefined") {
potato = await tp.system.prompt("Potato");
}
tR += "potato::"
%> <%* tR += potato %>
the <%* tR += %> allows you to insert the field anywhere. You'll notice that in the Flashcard section of the not that it utilises this to duplicate the fields in varying configurations for flashcards formatted for the Spaced Repetition plugin.
The reading field will probably not be relevant unless you're learning a language that uses a non latin script. Feel free to delete that section.
- Download the attached template (vocabulary template.md) below and add it to the template folder of your vault.
- Rename the template whatever you like, but remember its location and name.
- In the QuickAdd settings click
Manage Macros - In the
Macro Namebox at the bottom, input a name for your macro e.g.Vocab. Then hitAdd Macro - Hit
Configureon your new macro then add aTemplatechoice. - In the
Template Pathfield, point it to thevocabulary template.mdfile in your vault (or whatever you renamed it to). - Turn on
Append Link. All other settings adjust to your taste, I have my notes created in a new folder and open in a new pane so I can check it all inputed okay. - Return to the main QuickAdd settings window and choose
Templatefrom the dropdown menu in the bottom right corner, add a name for your choice and hitAdd Choice. This name will end up appearing in your command palette. - Click the lightnining bolt button to add a command to the command palette. Click the cog and select your
vocabmacro from the dropdown menu. - Go to the
Hotkeyssection of the main Obsidian settings and search for whatever you called your QuickAdd choice. (or just search forQuickAdd). Bind your QuickAdd choice to a hotkey, I usealt + V. - Exit settings.
Using Supercharged Links (which now has a very easy to use way to style links without having to use css) you can colour your links based on fields or tags. I give my vocab a specific tag, and then style it so the link shows green in my transcription note. I have a similar template for grammar which shows orange in my transcript note.
I think this is set up fine out of the box. You just need to make sure your version of the template has the same Flashcard tags as specified in the settings for Spaced Repetition so it automatically makes the card okay.
I have two cards. The first:
<%* tR += title %>
?
<%* tR += reading %>
<%* tR += definition %>
<%* tR += example %>
This has the word on the front and the reading (for Japanese Kanji), definition, and an example on the back.
The second:
<%* tR += definition %>
?
<%* tR += reading %>
<%* tR += title %>
<%* tR += example %>
Has the definition on the front, then reading, title, and example on the back.
The result of all this is you should be able to highlight a word in a source text in Obsidian, hit your hotkey (e.g. alt + V) and a new note will be created in a location that you specified and prompt you for things you want to appear in your flashcards. You can then choose Spaced Repetition: Review flashcards from all notes/in this note to see the cards you created!
The only slight annoyance in this workflow is that it requires that you copy the sentence you want to use as an example (from your transcript) before hitting your hotkey and creting a new template otherwise you're stuck typing it out into the field.
This is my first walk-through so please let me know if there's anything missing or coudl do with some more clarification. Enjoy!