View Source AnkiConnect.Services.AddNotesFromFile (anki_connect v0.1.1)

Provides functionality to upload notes from a given text file to Anki.

Link to this section Summary

Functions

Uploads notes from a given text file to Anki.

Link to this section Types

Link to this section Functions

Link to this function

add_notes_from_file(param)

View Source
@spec add_notes_from_file(%{
  file: String.t(),
  deck: String.t(),
  model: String.t() | nil,
  regex: String.t() | nil
}) :: {:ok, nil} | {:error, String.t()}

Uploads notes from a given text file to Anki.

parameters

Parameters

  • file - path to the file with notes
  • deck - name of the deck to which the notes should be added
  • model [optional] - name of the model to which the notes should be added, by default Basic
  • regex [optional] - regex used to parse the file

Default regex is -\s+(.*)\s+-\s+(.*) which means that the file should contain lines in the following format:

- back - front

where back and front are the back and front of the note respectively.

example

Example

File content:

- subsidiary - filia
- pageant - widowisko
- indispensable - niezbędny
- out-of-the-way - odległy
> mix anki_connect add_notes_from_file --file="words.md" --deck="TEST DECK"
[1684955655336, 1684955655337, 1684955655338, 1684955655339]