Anki-Android icon indicating copy to clipboard operation
Anki-Android copied to clipboard

Editing a note turns insignificant newlines into explicit line breaks

Open hssm opened this issue 11 years ago • 28 comments

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

hssm avatar Jul 28 '15 10:07 hssm

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

hssm avatar Jul 28 '15 10:07 hssm

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

hssm avatar Jul 28 '15 10:07 hssm

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

hssm avatar Jul 28 '15 10:07 hssm

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

hssm avatar Jul 28 '15 10:07 hssm

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

hssm avatar Jul 28 '15 10:07 hssm

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?

barkdoll avatar Oct 06 '17 01:10 barkdoll

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.

AxelRann avatar Jan 01 '18 19:01 AxelRann

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

chriskempson avatar Feb 09 '18 12:02 chriskempson

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

bzolka avatar Sep 04 '19 06:09 bzolka

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.

MightyPork avatar Sep 08 '19 07:09 MightyPork

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.

francisashley avatar Dec 25 '19 09:12 francisashley

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

mikehardy avatar Dec 26 '19 13:12 mikehardy

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

github-actions[bot] avatar Jun 03 '20 17:06 github-actions[bot]

shoo, shoo, stupid bot. still broken

MightyPork avatar Jun 03 '20 19:06 MightyPork

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

mikehardy avatar Jun 03 '20 19:06 mikehardy

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

github-actions[bot] avatar Aug 09 '20 20:08 github-actions[bot]

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 avatar Nov 15 '20 15:11 fireheart2008

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

mikehardy avatar Nov 15 '20 15:11 mikehardy

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

david-allison avatar Nov 15 '20 22:11 david-allison

Was this supposed to be fixed on 2.14? I'm still getting it on 2.15.4, in some situations, as I reported here.

euu2021 avatar Jul 06 '21 15:07 euu2021