HTML doesn't work on Desktop

Hi.

My html Card doesn’t work.
Do you have an idea why?


Which version of Anki are you using? You can see this by selecting Help / About from the menu.

Recent versions of Anki have a better way to create HTML. An icon that looks like < > appears at the top right of each input field, and clicking on it opens up an additional input box below the main one, where you can enter HTML.

I use 23.10.1 on Mac.

This is the html code


and the corresponding card

It does not fit together.

I think a quick solution would be to copy all the text in the upper (normal) input box and paste it into the lower (HTML) input box (wiping out what is already there).

The normal input box should never contain HTML elements.

I already copied it.

In the preview it looks good but the final question is wrong.

I also checked the card design but there shouldn’t be a barrier.

OK, at least this solves the problem of HTML tags like <b> appearing in the answer.

If you create a card of notetype Basic (or Basic and reversed, etc. notetypes), with
Front = klein
and Back =

<b>piccolo</b><br>
Komparativ: più <b>piccolo</b> / <b>minore</b><br>
Relativer Superlativ: il più <b>piccolo</b> / il <b>minore</b> (di tutti, -e)<br>
Absoluter Superlative: <b>piccolissimo</b> / <b>minimo</b> / <b>infimo</b>

then everything should work and display correctly.

What notetype are you using? If it is of your own creation, what code is in the Front Template and Back Template of the card? (what you displayed above is the Styling… the Front Template and Back Template are next to it)

By the way, and this is a separate issue, it might be better to have four separate cards instead of just one, because you are trying to learn four separate things here.

These are my Notetypes:

Fremdsprache (=foreign language) is my main one and I created it as “type answer in both directions”.

This is my Question:

And this is my Answer Card:

A problem that may be connected to that is that in my card management / library I can only see my Question twice:

This is because this field displays the first line of the Answer Card and not the Answer field. A dirty and annoying implementation in my opinion.

Yes, I see you are using {{type:Fremdsprache}} instead of just `{{Fremdsprache}}'.

But using type: means that you are expected to type in the answer instead of just looking at it and verifying that is correct. But the Fremdsprache field contains a lot of text… surely you are not expecting to type all of that?

In the table, there is just a short one-line column that can display only a limited amount of text. Both the front and the back of your card begin with the field {{Deutsch}}, so that is the only thing that can be displayed. There isn’t room for the rest of the question or the answer.

The usual arrangement, I think, is just to have the Sort Field (Sortierfeld) in the table, instead of the Question and the Answer. You see the answer when you review the card, you don’t really need it in the table too (and there isn’t enough room to display it there in the column).

Usually the Sort Field would be the first field. But you can change it by clicking on Felder… and then selecting “In der Kartenverwaltung nach diesem Feld sortieren”

Yes, I like to have {{type:Fremdsprache}} as default so I can check more easily. Usually the Answer is just one word. What I tried to format here with 4 Answers is a special case of one word (the comparative), which I won’t type in of course.

I can also use just one field when looking up my cards. That is not a big problem to me.

But being able to implement my cards with html is important to me. (And a basic feature, I guess)

I think using type: is incompatible with displaying a normal Back side of the card. Because it usually just shows a character-by-character comparison of your answer with the expected answer, with all matching characters in green, and non-matching characters in red.

You could also show the field twice on the Back side, once with type: and once without.

If your field contains a long string of text with HTML tags, you would have to type out all of it exactly. That doesn’t really make sense.

For this card’s data, you’d need to use a different kind of note, without type:. The note type you’re using here isn’t really suitable for what you have put into the Fremdsprache field.

You could create four separate fields and four separate cards, and you could also put HTML in the Front Template and Back Template.

1 Like

so {{type:}} is incompatible with html?

On the front side, {{type:Fremdsprache}} displays a line where you can enter the answer, which should exactly match what you have stored in that field.

On the back side, {{type:Fremdsprache}} will display a character-by-character comparison of what you entered with the actual contents of the field, using green and red for comparison. Here is an example: https://i.imgur.com/NKQnql2.png

If you want to show the actual field contents normally, with HTML displaying boldface and other formatting, then you have to use ordinary {{Fremdsprache}}.

1 Like

This solved the problem, I needed to create an extra Note Type for these cards. {{type:}} isn’t compatible with html.

Thank you! :smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.