How do I clear formatting of html copied text?

Erase button does nothing, also
even if text is removed the formatting of empty line is retained (which cause anything to be typed there to have that formatting)

See: Adding/Editing - Anki Manual

The main things the effectiveness of the formatting eraser depends on are –

  1. How is the formatting applied? – Click < > above the field to see the raw HTML.
  2. What options do you have selected in the formatting eraser? – Click the down arrow next to it to see what’s selected.
  3. What are you trying to remove? – Is it something the formatting eraser can remove?

The easiest way to remove formatting is not to paste it in the first place – Shift-paste will strip most formatting from the start.

The 2nd easiest way is to select and cut the text, and then Shift-paste it back into the field.

Yes, because of how HTML tags work, they can remain at either end of the line even when the text is removed. Usually a backspace in the field will erase that so you can paste again. But in a completely empty field, you might need to open the HTML view and delete the remaining tags.

1 Like

This is a limitation of the browser’s native document.execCommand('removeFormat') API - it only removes inline formatting (bold, italic, underline, font color, etc.) but does NOT remove block-level elements like headings (h1-h6) or lists (ol/ul).

I had to make a special command here https://ankiweb.net/shared/info/1066987105 and here https://ankiweb.net/shared/info/1758039001.