I already opened same thread, but it was about JS templates, and now about addons.
I want to modify card’s fields, without saving it to database. So, for example, a user will see word in Browse window, but will also see the word while learning.
Firstly I looked at hooks list, and saw there card_will_show hook, but it allows modifying HTML. When I looked at card argument, that this hook accepts, I saw that I can access card fields with card.note()["Field name"], and even modify it! Unfortunately it will not work with just card.note()["Field name"] = "value", Anki anyway shows old value, and it didn’t save anything. If I do card.note().flush(), it will save new value to the database (which I don’t want) and render old value, which is really strange.
I could make some kind of compilation step, which will fetch all cards and modify their values with saving it to database on Anki start, but it too many code and logic for my goal. If there is no way to do what I want, I will do this.
It sounds to me that such modification is achievable through javascript in your html templates.
Imagine for example that you have a field Description and you want to display it in UPPERCASE letters. In this case you can do the following in your html template
The following will happen. If for certain card the Description field was “My awesome description”, you will see “MY AWESOME DESCRIPTION”
It’s also possible to allow user to modify the content on the card without saving it to the database. For that you will need to have a form field prepopulated from the card field. As soon as you go to the next card, the changes are gone.
Yes, it really looks like what I’m looking for, but it will work on rendering time, so addons, like TTS ones, will not see it (the same as {{type:...}}).