I am creating this one because the old one (with the same title) has been closed (and I don’t see why, since the problem still exists today). And why I can’t include URLs here?!
Honestly I can’t believe that this has not been resolved yet. It’s not a minor issue, it’s a major flaw and makes for such a poor user experience. We are talking about basic HTML editing. There’s an add-on but it doesn’t seem to work. Finding and replacing each time is a chore. People shouldn’t be forced to such workarounds anyway. There is a minimum set of requirements that a software should meet, when a new release is made available to the public. People are going to invest their time learning how the software works. Anki is already far more complex than it should be, and the UI/navigation is poorly design and doesn’t meet modern design standards, with the browser added as a separate entity. It’s an open-source project, I don’t expect perfection, but please address issues like this, before adding any new features!
You can’t post links because you’re using a new account.
Volunteers work on whatever they like and you can’t really force it to happen. Besides, there are already perfectly working solutions to this problem such as these addons Google Search.
I did install the add-on that you mentioned before posting this, and unfortunately it does not work. It’s also not ideal to rely on add-ons that tend to break when there’s a new release.
I am obviously not forcing anyone to do anything. I am just saying that the implementation is sloppy, in ways that I find unacceptable. Even if the software is open-source, people are going to invest their time to learn it. If they have to constantly adapt to sub-optimal workflows, they might feel entitled to provide useful feedback. So I suggest that we drop our egos and focus on making things better, without expecting unnecessarily polished language.
I don’t like your language and I expect no developer will be willing to fix this for you as long as you stay like this. I’m not responding any further.
Nobody is supposed to work for me, but my expectation is that when people work on something that other people are going to use, they either do it well, or rather not do it at all. I am not happy to waste my time searching for solutions to problems that were created by someone else’s sloppy implementation. As mentioned already, this is just one in a long series of issues that Anki is riddled with. If there is no solution to this, I will find one myself. I suggest you just speak for yourself and not for other people. I know some people maybe a even a majority, won’t like my language, but I am confident there is a minority who does understand the context and can take feedback in without their ego being hurt. Meditation helps. Thanks!
The Anki developers are probably already aware of this issue but they’re intentionally leaving it as is because auto processing it risks breaking the HTML of the cards for users using it.
The original author of the nbsp remover has not been active recently and the add-on is broken, instead my repaired version is available. If it doesn’t work fine please contact me.
addon: nbsp Remover - Auto remove HTML spaces in bulk
The original author of this nbsp remover is one of Anki’s key contributors (kleinerpirat) they could have integrated it into Anki but instead developed an add-on, IMO Anki contributors often create add-ons for features that were difficult to integrate into Anki, so I think there might be some issues or risks. (but I’m not involved with them so I don’t know exactly)
Yes I was aware of that, but there must be a better way. In my case, the problem was not the nbsp per se, but the fact that when adding a space while editing a card containing formatted text (e.g. bolded), it would automatically add a normal space PLUS a nbsp. So the end result is that when the card is in edit mode it looks fine, but when it’s rendered in preview or study mode, a double space appears (one normal, one nbsp). I had to edit the HTML of every single card manually in order to avoid that. I am pretty sure there’s plenty of ready-made WYSIWYG editors out there that already addressed such problems, so I am not sure why Anki can’t just have a normal editor that works.
Anyway, thanks so much for leaving your comment and the link to your add-on. Since the command can be launched at will, that’s really a life saver, and it works! I’ve made a small donation, thank you very much for your work.
Have you considered that your experience isn’t a universal experience?
It might help if you started with an explanation of your use-case/the problem you are hoping to solve with this suggestion (instead of how upset you are about this). It’s possible there’s a solution to your issue. [I didn’t merge your thread with the other user’s request for help because I their thread has been closed for years, and it’s not clear to me that you are having the same issue.]
I’ve never found this to be problematic. Yes, I’ve seen a surprise nbsp show up every once in a while, but it’s certainly not something that happens every time I’m editing formatted text. And I don’t think I’ve ever seen it turn a single-space into a double-space, like you’re now mentioning.
I also use nbsps myself, when needed to control formatting for a field, so I would be among those who wouldn’t appreciate the app stripping them out completely.
My issue is indeed not exactly the same as the previous post, although I guess it’s strongly related. I am adding some screenshots for reference.
See HTML snipped below:
To <b>nie</b> jest mój dom.<br>Ja <b>nie</b> wiem, co robić.
For the cards I am using a great font called Charter (which is free to use and easily downloadable).
Steps to reproduce:
Starting from the above ([screenshot named ‘Start’], do whatever would cause the editor to automatically replace the normal space with a nbsp, e.g. by adding some characters next to a bolded word, as in the example (cursor in first example is positioned after the space, right before the ‘j’ in ‘jest’). The nbps in rendered in the preview as if there were two spaces there (in reality, it’s just a larger space).
The exact same result can be achieved by typing it a space right next to the bolded word, or in other ways, but essentially the problem is still the same: a normal space is replaced with a nbsp [‘Edit 2’]. This seems to happen every time the edit is made contextually to some formatted text (e.g. bolded, italic).
I tried to test it without the CSS above and it clearly shows that this happens with some fonts, like the one I am using, and not with others [*].
I have now replaced the ‘Charter’ font family with ‘Palatino’ in the CSS and it seems to work fine. The nbsp is also rendered like a normal space if I remove the CSS altogether.
I would recommend to implement targeted whitespace normalisation on card save, so that a non-breaking space would be preserved only when needed (e.g., bullet lists). This would leave the markup as faithfully to the user’s visible input as possible.
[*] This is the most likely explanation according to GPT: "What is probably happening is one of these two things.
First possibility: the Charter font installed/available to Anki defines U+00A0 with a wider advance width than the normal space. That means the no-break space is literally drawn as a wider space. It may look like two spaces even though it is only one character.
Second possibility: Anki’s rendering engine cannot find U+00A0 in that particular Charter font file, or handles it oddly, so it falls back to another font just for that character. Font fallback for whitespace can create strange spacing because the fallback font may have different metrics. This is less obvious than fallback for visible letters, because you do not “see” the fallback glyph — you only see its advance width.
This is why removing the CSS fixes it: without Charter, the preview falls back to a font where U+00A0 has normal space width."