Bug: incorrect spacing when toggling italic mode

Let’s say I am making a card, typing “foo bar baz” into the front (or back), and wish to make “bar” italic.

I can type foo<space><cmd-i>bar<cmd-i><space>baz, but this generates the following underlying HTML: foo <i>bar</i>&nbsp;baz. I don’t want the non-breaking space there, it messes up formatting somewhat-often (especially with longer words). It seems to me that the presence of the non-breaking space is a bug.

Or, I can type foo<space><cmd-i>bar<space><cmd-i>baz, but this generates foo <i>bar </i>baz, which is also not really correct (and IMO it would be cool for the editor to attach the closing tag to “bar” automatically given these input keystrokes but that’s debatable).

1 Like

I have to agree with the fact, when editing cards in HTML mode I often realize how many (non-wanted) non-breaking spaces Anki automatically inserts.

This behaviour comes from the web toolkit. @hengiesel has made some changes in this area, but I’m not sure whether they address this particular problem or not.

1 Like