Styling
If a note type is created or edited then Anki Script looks for a css definition file named
alias.css
,
where alias is the alias used in the script for the note type. If such a file is found the contents are
used as the note type's styling. The file should be in the a alias
directory under the setup / lesson
directory .
Note that any css file in the media dir referenced (via
@import
) is not automatically copied to the media collection.
Fields
To set tag values use a field name Tags:
add verb note, setting fields Russian to знать, English to "to know", Tags to "lesson2 1st"
Field values may contain HTML markup.
Note that media files referred to by field values are automatically copied by Anki
Script when the field value is set.
Note that scripts can only add fields - there is no currently provision to remove them.
Card templates
If a note type is created or edited then Anki Script looks for files defining the card contents, one for the front side and
another for the back. The files should be in the a
alias
directory under the setup / lesson directory
.
The file names should have a
.front
extension for defining the contents of the front side, and .back
for the back side. For non cloze note types the file basename is the card name, transformed using the following rules:
- an underscore replaces a space or any of ()[]{}:
- any of $*, are ignored
- < is replaced by _from_
- > is replaced by _to_
${NAME}
is replaced by_NAME_
- repeated underscores are reduced to a single underscore
- a leading or trailing underscore is removed
- card template name
- filename for card front side
- a b
- a_b.front
- a<b
- a_from_b.front
- a>b
- a_to_b.front
- a(b)
- a_b.front
- a[b]
- a_b.front
- a$b
- ab.front
- *ab
- ab.front
- ab:
- ab.front
- a${GENDER}b
- a_GENDER_b.front
- ${PERSON}
- PERSON.front
- a ${CASE} ${GENDER}
- a_CASE_GENDER.front
- e>r (past, ${GENDER})
- e_to_r_past_GENDER.front
As the single card template is automatically defined for cloze note types, and not named in the script, for cloze note types
the card definitions are looked for in files named
alias.front
and alias.back
. As
for non-cloze note types the files should be in the a alias
directory under the setup / lesson directory
.
Note that scripts can only add card templates - there is currently no provision to remove them.