pylib/tools/genhooks.py and qt/tools/genhooks_gui.py.
See Hooks & Filters for usage instructions.
Backend Hooks (anki.hooks)
card_odue_was_invalid
No arguments.
No docstring.
schema_will_change
Args: proceed: boolReturns:
bool
No docstring.
notes_will_be_deleted
Args: col: anki.collection.Collection, ids: Sequence[anki.notes.NoteId]
No docstring.
note_will_be_added
Args: col: anki.collection.Collection, note: anki.notes.Note, deck_id: anki.decks.DeckId
Allows modifying a note before it’s added to the collection.
This hook may be called both when users use the Add screen, and when
add-ons like AnkiConnect add notes. It is not called when importing. If
you wish to alter the Add screen, use gui_hooks.add_cards_will_add_note
instead.
media_files_did_export (Obsolete)
Args: count: int
legacy_export_progress (Obsolete)
Args: progress: str
exporters_list_created
Args: exporters: list[tuple[str, Any]]
No docstring.
media_file_filter
Args: txt: strReturns:
str
Allows manipulating the file path that media will be read from
field_filter
Args: field_text: str, field_name: str, filter_name: str, ctx: anki.template.TemplateRenderContextReturns:
str
Allows you to define custom {{filters:..}}
Your add-on can check filter_name to decide whether it should modify
field_text or not before returning it.
note_will_flush
Args: note: Note
Allow to change a note before it is added/updated in the database.
card_will_flush
Args: card: Card
Allow to change a card before it is added/updated in the database.
card_did_render
Args: output: anki.template.TemplateRenderOutput, ctx: anki.template.TemplateRenderContext
Can modify the resulting text after rendering completes.
importing_importers (Obsolete)
Args: importers: list[tuple[str, Any]]
deck_added (Obsolete)
Args: deck: anki.decks.DeckDict
note_type_added (Obsolete)
Args: notetype: anki.models.NotetypeDict
sync_stage_did_change (Obsolete)
Args: stage: str
sync_progress_did_change (Obsolete)
Args: msg: str