Skip to content Skip to sidebar Skip to footer

Anki - What Should I Hook To Add My Own Field Descriptors?

Similarly to {{field}} and {{text:field}}, I am trying to create my own field descriptor. In order to do this, I need to know what function to hook. I do not know whether Anki pre-

Solution 1:

Anki pre-compiles to HTML, and I have found the function that deals with "Moustache tags" in template.py.

By registering the hook fmod_<modifier> with a function taking a filter parameter txt and (fixed) parameters extra, content, tag and tag_name one can register a modifier for that name.

That last parameter, tag_name, is probably the one you want, as it is a string that contains everything between the {{ and }} marks.

Post a Comment for "Anki - What Should I Hook To Add My Own Field Descriptors?"