Weird HTML tags in content


Here’s the problem I get when creating a card with Anki Desktop (mac) and read it in AnkiDroid. It’s been something like a year since this bug occurred (cause I never had this issue before). When I paste some text from the web, I use the CMD+shift shortcut which removes any formatting and it looks ok when I save the
card in Anki Desktop. If I open the card in AnkiDroid, several blocks can be on a single line and I need to manually remove the & npsp; HTML chars for the line break to work as it used to a while ago.

kind regards.

Those are non breaking spaces and they usually come from PDF content or heavily formatted web pages. You’re seeing them in AnkiDroid because its editor displays the raw field HTML, but they are there in Anki Desktop too.

I made this add-on a while ago that automates the removal of those: nbspRemover - AnkiWeb

The reason Anki doesn’t remove them by default is that some people actually use those to format text (I think).

In my whole time on the forum I only came across a single person who said the character was useful to them. Maybe we should reconsider the current behavior.


I do worry about unintended side-effects. One alternative I’ve thought about in the past is making the default notetypes use white-space: pre-wrap. It would mean multiple spaces would no longer get converted into nbsp, and newlines would work with \n instead of requiring a <br>. The big question would be how it worked with pasted/imported content though - at the least I guess we’d need to strip out newlines and collapse whitespace when pasting in.

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