Anki-android: Editing a note turns insignificant newlines into explicit line breaks

Created on 28 Jul 2015  路  19Comments  路  Source: ankidroid/Anki-Android

Originally reported on Google Code with ID 2408

AnkiDroid v2.3.2/Android 4.3:

There is a field on some of my notes that contains HTML code as follows:

---
<h2>Headline</h2>

line 1<br />
line 2<br />
...

---

AnkiDroid displays this correctly.

But whenever I edit and save such a note, even if I do not touch that particular field,
each (insignificant) newline gets turned into another explicit line break, so I end
up with double-spaced output:

---
<h2>Headline</h2>



line 1

line 2

...

---

Expected behaviour:

1. AnkiDroid should not modify a field I did not edit.

2. AnkiDroid should not make insignificant whitespace read from existing content significant
when editing. For me, it would be acceptable to have it stripped if that helps (i.e.
to have the data above internally turned into 

  "<h2>Headline</h2>line 1</br>line2</br>..."

before being fed to the edit box); see 1. though.

Reported by [email protected] on 2014-11-17 11:56:10

Bug Keep Open Priority-Medium Reproduced

All 19 comments

This problem has caused me a lot of unnecessary work as well. The Anki Windows version
handles HTML nicely, so I have to switch frequently and correct mistakes Ankidroid
introduced. I would appreciate if suggestion 2 would not be necessary.

Reported by [email protected] on 2015-01-26 20:44:23

This isn't a problem for most users because they include their formatting in the card
template rather than the fields themselves. I strongly suggest you do the same as this
may not get fixed for a while unfortuantely

Reported by perceptualchaos2 on 2015-01-27 00:07:38

I do that for basic formatting of course, but I麓m afraid that doesn麓t make much sense
when it comes to structuring longer cards with list etc. So I hope someone will tackle
this problem one day...

Reported by [email protected] on 2015-01-28 22:59:28

I agree that an edit-save cycle with no actual changes should not modify the content.

Reported by nicolas.raoul on 2015-04-21 06:48:44

  • Status changed: Accepted
  • Labels added: Priority-Medium
  • Labels removed: Priority-Undecided
I am having issues with this too, even editing tags to the card will trigger this behaviour.

I think users that care more about mark-up of the cards and e.g. use more lists (dl
tags and nested lists) run into this issue. 

Reported by emil.rehnberg on 2015-06-18 05:53:41

I have run into the same issues with automatic <br /> tags being entered when editing my cards. I would prefer if these did not generate when saving my cards as well. Has anyone looked into this bug as of recent?

I have this problem as well. Not being able to edit a card from my phone without rendering it unreadable is a big pain. Anyone dealing with this would be a hero.

I think the problem wont be solved until AnkiDroid supports HTML rendering when editing fields which would bring it inline with the desktop version.

This is causing quite a lot of extra work to me as well, would be great to have this fixed.

same issue here, two times I tried to correct a card on my phone and two times i had to fix it on desktop later. Learning to never edit on the phone, it's just not worth it.

Screenshot_20190908_092208

Tip: Ctrl+Shift+X in the card browser opens raw HTML so you can find-replace all <br> with nothing.

Same issue here.

Updating a note in AnkiDroid inserts six additional <br> tags which messes with the template.

The only way to see and fix these tags is to edit the card in the desktop client.

It would indeed be great to "have this fixed" but no one has proposed a fix yet - we would welcome a fix for it https://github.com/ankidroid/Anki-Android/wiki/Contributing

Hello 馃憢, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like _still searching for solutions_ and if you found one, please open a pull request! You have 7 days until this gets closed automatically

shoo, shoo, stupid bot. still broken

@MightyPork you might like the preview of the visual editor: https://github.com/ankidroid/Anki-Android/issues/1377#issuecomment-616778637

Hello 馃憢, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like _still searching for solutions_ and if you found one, please open a pull request! You have 7 days until this gets closed automatically

Oh my god! This bug is driving me crazy!
It's unfathomable that this bug was reported 5 years ago and still existing in late 2020

@fireheart2008 we would love to see it fixed! Do you have a solution you could propose?

Round 2 - let's add a preference. This should be viable now a user can add a custom toolbar button for <br/>

Was this page helpful?
0 / 5 - 0 ratings

Related issues

littlefoodt picture littlefoodt  路  4Comments

mikehardy picture mikehardy  路  5Comments

david-allison-1 picture david-allison-1  路  4Comments

Acelya-9028 picture Acelya-9028  路  4Comments

infinyte7 picture infinyte7  路  4Comments