Line breaks are ignored on the input text

Hi,

For some reason line breaks seem to be ignored on the input field (when the answer is shown), even though there’s <br> element. This is the case in every platform - Mac/iOS/Android.

So, if my answer field looks like this:

hello

goodbye

It instead shows up as:

hellogoodbye

Every other field shows line breaks properly, except the field that matters most…

Any ideas?

Could you post the template for the card for which the rendering is broken?

2 Likes

This is the answer section in my template (“Target” is the answer field) :

<div id="answer">

	<h2>Answer</h2>

	{{type:Target}}

</div>

By the way, I realized that if I instead use {{Target}} (without the type:), then the line breaks work fine… but obviously this has the downside of not showing me whether or not I got the answer right…

The type-in-the-answer feature only supports a single line of text.

I’m not talking about the type in feature (although it would be nice to support multiple kinds in the type-in as well). I’m talking about the back of the card - where it highlights the parts I got right and wrong, which just happens to use the same “type:” format.

For example, I have a English to Spanish deck, where I include synonyms of a certain word in the same answer field. Since there’s no one “right” answer, I’d like the answer to highlight which word I got right, but then also show me the rest of the synonyms I could use in the same context. The way I do this is separating the words by a line break…but as I already mentioned, the back of the card disregards the line break and clumps all the words together.

It does not just happen to use the same format. It’s actually the same feature, which has two components: an input component, for the front card, and an error highlight component, for the back card. So when @dae says this feature only supports a single line of text, it includes the error highlight component, as you are witnessing yourself.

2 Likes

In that case, can you please add that as a feature request? To support multi-line type-in. And/or separate the two components (a-la separation of concerns)

The type-in feature is currently being rewritten (or, at least, a complete rewritten is being planned from compatibility reasons mainly). This feature is probably not being added until that whether or not it is accepted.

But this doesn’t mean you can’t have access to that feature right away. Anki is quite customisable, and, for this kind of features, I would suggest taking a look at javascript which is the scripting language supported by webviews Anki.