Defines one study direction by mapping note fields to a card front and back. More...
Properties | |
| string | Name = Name [get] |
| Gets the display name shown for this card type in Anki. | |
| string | QuestionFormat = QuestionFormat [get] |
| Gets the unsanitized Anki HTML/template markup used for the card front. | |
| string | AnswerFormat = AnswerFormat [get] |
| Gets the unsanitized Anki HTML/template markup used for the card back. | |
| string? | BrowserQuestionFormat = BrowserQuestionFormat [get] |
| Gets the optional markup used for the question column in Anki's card browser. | |
| string? | BrowserAnswerFormat = BrowserAnswerFormat [get] |
| Gets the optional markup used for the answer column in Anki's card browser. | |
Defines one study direction by mapping note fields to a card front and back.
| Name | The non-blank name shown in Anki's card-type editor, unique within its note type ignoring case. |
| QuestionFormat | Anki HTML/template markup for the front, for example {{German}}. The value must be non-null but may be empty. |
| AnswerFormat | Anki HTML/template markup for the back. {{FrontSide}} reuses the already-rendered front. |
| BrowserQuestionFormat | Optional markup for Anki's browser question column, or null to emit no browser-specific override. |
| BrowserAnswerFormat | Optional markup for Anki's browser answer column, or null to emit no browser-specific override. |
The formats use Anki's template language, not C# interpolation. Common expressions insert a field, conditionally show a section based on a field, reuse {{FrontSide}}, or apply modifiers such as {{type:Field}} and, for Cloze models, {{cloze:Text}}. Values may also contain ordinary HTML and media references.
AnkiIO stores markup verbatim and never renders, HTML-sanitizes, or executes it. Validation reports unknown field references in the main question/answer formats, but it is not a full Anki template compiler: it does not prove that conditional sections are balanced, that HTML is safe, or that browser-specific formats render. Test custom templates in the Anki version you support.
A Standard note normally receives one card per template in insertion order. AnkiIO creates that card eagerly and does not evaluate conditional templates to decide whether an empty card should be omitted. A Cloze note instead receives one card per distinct positive cloze index in its Text field; adding more templates does not create more Cloze cards.
Constructing this immutable record does not validate its arguments. Attach it with AnkiNoteType.AddConfiguredTemplate to validate required values and uniqueness before use.
Definition at line 48 of file AnkiCardTemplate.cs.
|
get |
Gets the unsanitized Anki HTML/template markup used for the card back.
The answer format supplied to the primary constructor.
Definition at line 65 of file AnkiCardTemplate.cs.
|
get |
Gets the optional markup used for the answer column in Anki's card browser.
The browser answer format, or null when no browser-specific override is emitted.
Definition at line 73 of file AnkiCardTemplate.cs.
|
get |
Gets the optional markup used for the question column in Anki's card browser.
The browser question format, or null when no browser-specific override is emitted.
Definition at line 69 of file AnkiCardTemplate.cs.
|
get |
Gets the display name shown for this card type in Anki.
The name supplied to the primary constructor; validated when attached to a note type.
Definition at line 57 of file AnkiCardTemplate.cs.
|
get |
Gets the unsanitized Anki HTML/template markup used for the card front.
The question format supplied to the primary constructor.
Definition at line 61 of file AnkiCardTemplate.cs.