AnkiIO 1.0.2
Build, validate, import, and export Anki-compatible decks from .NET
Loading...
Searching...
No Matches
AnkiIO.AnkiField(string Name, bool IsRightToLeft=false, bool IsSticky=false, string Font="Arial", int FontSize=20) Class Referencesealed

Configures one named input field in an AnkiNoteType. More...

Properties

string Name = Name [get]
 Gets the exact field name used by note values and template references.
bool IsRightToLeft = IsRightToLeft [get]
 Gets whether compatible Anki editors should use right-to-left input for this field.
bool IsSticky = IsSticky [get]
 Gets whether compatible Anki editors may retain this field's value for the next manually entered note.
string Font = Font [get]
 Gets the note-editor font-family preference, not the rendered card font.
int FontSize = FontSize [get]
 Gets the note-editor font-size preference in pixels, not the rendered card size.

Detailed Description

Configures one named input field in an AnkiNoteType.

Parameters
NameThe field name used as the exact key in AnkiNote.Fields and in template expressions such as {{German}}. Names must be non-blank and unique within a note type without regard to case.
IsRightToLefttrue to request right-to-left input in compatible Anki editors. This is an editor hint; it does not add direction: rtl to card CSS.
IsStickytrue to ask compatible Anki editors to carry the previous value into the next new note. This does not copy values when notes are created through AnkiIO.
FontThe non-blank font-family preference for Anki's note editor. It does not select the font on rendered study cards.
FontSizeThe positive editor font size in pixels. It does not change the card's rendered font size.

Field order is significant: Anki package formats store note values positionally, and AnkiNoteType.Fields defines that order. Add configured fields before creating the first note, because the note type freezes on first use.

Font, FontSize, IsRightToLeft, and IsSticky describe the note editor only. Put presentation rules in AnkiNoteType.Css or the card template. Constructing this immutable record does not validate its arguments; AnkiNoteType.AddConfiguredField validates them when the field is attached, which allows ordinary with expressions while keeping invalid definitions out of a note type.

var field = new AnkiField("Arabic", IsRightToLeft: true, Font: "Noto Sans Arabic", FontSize: 24);
var type = new AnkiNoteType("Vocabulary").AddConfiguredField(field);
Configures one named input field in an AnkiNoteType.
Definition AnkiField.cs:45
int FontSize
Gets the note-editor font-size preference in pixels, not the rendered card size.
Definition AnkiField.cs:64
bool IsRightToLeft
Gets whether compatible Anki editors should use right-to-left input for this field.
Definition AnkiField.cs:52
string Font
Gets the note-editor font-family preference, not the rendered card font.
Definition AnkiField.cs:60
Defines the reusable schema and rendering rules shared by a family of Anki notes.
AnkiNoteType AddConfiguredField(AnkiField field)
Adds a configured field at the end of the field order.

Definition at line 39 of file AnkiField.cs.

Property Documentation

◆ Font

string AnkiIO.AnkiField.Font = Font
get

Gets the note-editor font-family preference, not the rendered card font.

The font name supplied to the primary constructor, or Arial by default.

Definition at line 60 of file AnkiField.cs.

◆ FontSize

int AnkiIO.AnkiField.FontSize = FontSize
get

Gets the note-editor font-size preference in pixels, not the rendered card size.

The size supplied to the primary constructor, or 20 by default.

Definition at line 64 of file AnkiField.cs.

◆ IsRightToLeft

bool AnkiIO.AnkiField.IsRightToLeft = IsRightToLeft
get

Gets whether compatible Anki editors should use right-to-left input for this field.

true when right-to-left editor input is requested; otherwise, false.

Definition at line 52 of file AnkiField.cs.

◆ IsSticky

bool AnkiIO.AnkiField.IsSticky = IsSticky
get

Gets whether compatible Anki editors may retain this field's value for the next manually entered note.

true when the field is sticky; otherwise, false.

Definition at line 56 of file AnkiField.cs.

◆ Name

string AnkiIO.AnkiField.Name = Name
get

Gets the exact field name used by note values and template references.

The name supplied to the primary constructor; validated when added to a note type.

Definition at line 48 of file AnkiField.cs.


The documentation for this class was generated from the following file: