Remove non-breaking spaces

A discussion recently came up where Anki’s frequent insertion of  s (non-breaking spaces) is causing a number of formatting issues with respect to card content wrapping to the viewable window, particular on smaller mobile devices. Unfortunately, it seems that while the Anki team is aware of the issue, there are no easy fixes they can implement as discussed here: Unexpected non breaking space inserted after using mathjax or latex shortcuts in editor · Issue #1053 · ankitects/anki · GitHub

As a syncing platform of its own, AnkiHub could solve this issue for users in one of two ways:
(1) On upload of new cards or changes, automatically replace all  s with spaces in the database. This can easily be done server-side by whatever API endpoint is used to make submissions. These changes would then be applied to all new users on their next sync - for the submitting user, there would need to be a way to guarantee these change are synced as well.
(2) Have the add-on automatically perform the same replacement each time the app is synced with AnkiHub

Potential issues:

(1) Such changes should somehow be “automatic” without requiring maintainer approval, as this would add a lot of noise to otherwise important content changes. For this reason, having the server handle it rather than the add-on is preferred.
(2) There could be valid use cases for   with Anki but I have yet to run into any instances where this was the case or where the non-breaking formatting was necessary. Having done a Find & Replace to convert them all the spaces in my own deck, I’ve had no issues.
(3) If the deck maintainer decides they don’t want this being automated, the option to disable the feature can be considered. Referencing issue #2 though, I’m not sure this is really needed.

2 Likes

There’s an addon that does this.
https://ankiweb.net/shared/info/1676672391

I’ve removed the vast majority from the deck just now and pushed those changes to AnkiHub officially. All changes can be seen in the changelog.

The remainder can be removed once the image replacement project is complete.

I wanna bump this up again now that the image replacement project is complete. Anytime anyone sends in edits more of these are created

Is there a way to have AnkiHub automatically remove them?

3 Likes

One idea I had is to perhaps just clean them as suggestions are made to AnkiHub. Then we just need to do a one time cleansing and they won’t be reintroduced like last time