Hello Dear Anki Devs 
I am working on a Add-on for my university, in which I want to save some data about the card, the user answered. For Example, how long did the user took to answer, or what card the user answered.
What is my goal?
Save the text of the card in a temporary object. Including “Question” and “Answer” texts of the card.
What is my Problem?
The text I am getting from the Anki Card Object is the front HTML of the card with an ID-Tag, or sometimes empty. I could not figure out when it is empty. Maybe just a code error on my side.
What have I tried?
The following:
I found a method of extracting the “Question” of a card via python:
temp_card_data.question = data.render_output().question_text
which works as expected. The content of ‘temp_card_data.question‘ is the plain text the card holds in it’s “Question-Field” without HTML.
Then I tried the following for the “Answer” text, in this case for a simple ‘print’ statement:
print("Answer Text_'data.answer()': " + str(data.answer()))
print("Answer Text_'render_output().answer_text': " + str(data.render_output().answer_text))
The first one results in the following console-output:
Answer Text_'data.answer()': <style>.card {
font-family: arial;
font-size: 20px;
line-height: 1.5;
text-align: center;
color: black;
background-color: white;
}
</style>Welche Frabe hat die Sonne?
<hr id=answer>
[[type:Back]]
It includes some formatting information, the “Question” text and ‘
‘
The second try ‘data.render_output().answer_text‘ results in this one:
Answer Text_'render_output().answer_text': Welche Frabe hat die Sonne?
<hr id=answer>
[[type:Back]]
Which is only missing the style-tag.
Question
How is it possible to get the clean rendered text of the “Answer” field? For “Basic type in the answer” Cards.
More Detail of the Card I am using to test this in the png’s.
I am happy for any bit of help and looking forward to chat, Moritz (:
