Paste adds <div> tags

When I paste text from another app into the field of a note, Anki wraps the content in <div> tags.
I tried using <shift>-Paste (to strip formatting) but this had no effect. The same is true if I choose the setting “Paste without shift key strips formatting”. Removing these <div> tags is a pain.

If I choose “plain copy” in the other app, the text is pasted without tags.
(I am using a Mac.)

1 Like

This has bothered me too. Along with the introduction of non-breaking spaces (I’m not quite sure when those are added, but my flashcards are littered with them).

1 Like

Recent Anki versions should usually use <br> for newlines in pasted text. Maybe the field already contained a div? Can you reproduce it with the latest beta? Anki 2.1.55 Beta

I am not pasting text with returns. Just a single word that I copied.
But I now see that there is a difference between apps. I generally use Nisus Writer. If I copy from NW and paste into Anki I get the text wrapped with <div> tags and nothing else. Shift-paste has no effect.

If I try the same from MS Word (which I don’t usually use) I see that I get a span with formatting attributes. Those can be suppressed using shift-paste, at which point I just get the plain word.

For completeness sake I tried pasting text with a return, copied from Nisus Writer, into Anki. This gives me no <br>. Instead it just gives me separate <div>s.

I’m guessing that Nisus Writer is putting text on the clipboard as HTML. The strip styling option removes things like text colors. It does not remove all HTML, as then all the text would end up on one line in such situations.

Thank you for your reply. I will ask Nisus about this.