Do not strip 'alt' attribute when pasting images from the web

A lot of images on the web come with an ‘alt’ attribute, that specifies an alternate text in case the image cannot be displayed; this attribute gets lost upon pasting into Anki.

I think it would be quite useful if it was kept instead.

e.g.

  • it would be helpful when media synchronization upon multiple devices is yet to be completed or encountered some errors
  • it often contains infos about the image source
  • it would add some keywords to the image, which could then be used when searching the browser

Also, the ‘alt’ attribute usually comprises just a few words, so, as far as I understand, it should not ‘weigh’ much on disk space, memory etc.

I’ll make this change in the next beta; hopefully people don’t prefer it the old way.

1 Like

Hmm, I think this should be made a preference or something. I personally want my alt elements stripped completely.

1 Like

It’s very niche. Probably better served by a custom add-on.

1 Like

It seems like there are several ways you could take care of the alt-text yourself –

  • After you paste the image, open the HTML view and remove the alt="..." section.
  • Remove the alt-text from a batch of notes using Find and Replace.
  • Avoid adding the alt-text in the first place –
    • Paste the image by URL/address (which Anki will download/localize), instead of by copying the image itself.
    • Attach an already-saved image, instead of pasting a copied one.
1 Like