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 (:
