Edit Multiple Fields in Multiple cards at once

Is there a way that I can edit multiple fields in multiple cards at once?

I am making a shared deck, & many of the cards were formatted to have dark text, which is impossible to read for people who use the night-mode theme. The note type style already has some code to address this issue (shared below); however, the text still appears hard to read. I can fix each card by selecting the text, & then clicking Remove Format, however, this requires me to go by each field of the card for multiple cards & the deck has ~28,000 cards.

I was hoping that there would be a way for me to select all cards & remove format, kind of like how someone would select all cards from a deck & toggle suspend.

Thank you for your help.


/* ~~NIGHT MODE COLORS~~ */
/* NM DEFAULT TEXT COLOR*/ 
	.nightMode.card, .night_mode .card
     { color: #ffffff !important; }
/* NM BACKGROUND COLOR*/ 
	.nightMode.card, .night_mode .card { background-color: #272828!important; }
/* NM CLOZE COLOR */
 	.nightMode .cloze, .night_mode .cloze { color: gold !important; }
/* NM "EXTRA" FIELD COLOR */	
.nightMode #extra, .night_mode #extra { color: #369ff5; } 

Have you tried Find and Replace?

I’m not sure I understand what you’re getting at with this. What would I search for? And what would I replace with?

I’m trying to change the format for nearly 28,000 cards, & I don’t know a phrase that could be searched for that would be present in all of the cards.

There is likely some inline-HTML formatting in your fields, that could be removed this way.

You can use regex (regular expressions). It’s powerful enough to help you with removing HTML tags. Just an example, \d{10} can search any 10 digit number.

Read the link posted earlier if you’re interested.

Sorry, I understood that you had already recognized the scope of the issue, but if you’re only looking at the surface text, you might not have seen that yet. :sweat_smile:

Everything you see in Anki is written and formatted with HTML tags (and CSS. If you open the HTML view of a field – by clicking <> above the field – you can display that.

Once you figure out what HTML tags are being used, you can use Find and Replace to delete them from all of your notes at once. This is essentially what the “format eraser” is doing for you – removing a set list of HTML tags.
image

This comes with certain challenges –

  1. There are often multiple ways to apply the same formatting in HTML. You can see in this example that superscript-gray text is applied for one part with <sup><span style="color: rgb(128, 128, 128);">... and for another part with <font color="#808080"><sup>.... So it can take multiple tries to clear the formatting from everything.
  2. It’s a blunt instrument, and will remove formatting even from text that you want to remain formatted. [Although Find and Replace can be limited to certain notes and certain fields.]
  3. If you’re not familiar with HTML, there can be a bit of a learning curve to recognizing what you’re looking for. Sites like W3Schools are great for learning the basics.
  4. HTML tags come in pairs, so you also need to find the end tags and delete those. [Although in a pinch you can sloppily “gut” the tags instead, like by removing the attribute and leaving a tag in place that doesn’t do anything anymore.]

Now that I’ve set you up for how scary this can be… You’re only talking about one specific format – text highlighting/background – so that increases the likelihood that you’ll be able to do this efficiently! :+1:t4:

As a first step, open up the HTML view and see if the tags are at least consistent from note to note and field to field. Consider whether you have a lot of other formatting that you’ll need to make sure you’re protecting.

If you want to post a sample of what you’re seeing, so that folks can help you come up with find/replace queries that might work, please post it as text in a code block (like you did above).

3 Likes

Oh I see! Thank you for the great explanation.

Here is an example of the html in the “Front” field:

<span style="color: rgb(51, 51, 51);">Characteristic neuromuscular manifestations of uncontrolled hypothyroidism include what clinical sign?</span>

Here is an example of the html in the “Extra” field:

<div><i style="caret-color: rgb(51, 51, 51); color: rgb(51, 51, 51);"><br></i></div><div><i style="caret-color: rgb(51, 51, 51); color: rgb(51, 51, 51);">Clinical manifestations of uncontrolled hypothyroidism include muscle weakness and pain. Polyneuropathy attributed to hypothyroidism is typically a demyelinating neuropathy that favors motor neurons. Upper motor neuron signs are not observed</i><span <br=""></span></div><div><i style="caret-color: rgb(51, 51, 51); color: rgb(51, 51, 51);"><br></i></div><span <div=""><img src="image-25c309f8b1252e9ab834f2a72343cb90e7d34226.jpg"></span>

Here is a screenshot of of the html of another note type, in which the front color changes appropriately when switching between light/dark modes. I shared the screenshot of the html instead of pasting the code because there is nothing special in the included code.

When I just delete the html <span & color codes, the card can no longer be changed to night mode, it only stays in light mode, so I must not be doing that right.

What would y’all recommend replacing the html code with? I just want to fix the color. I don’t mind any of the bold/underline/italics, but also I don’t care if that format gets cleared.

Turns out that solution worked. All I had to do was change the note type to a different note type & when I deleted the html code using the Find & Replace tool, the format showed up exactly how I wanted (both in night mode & light mode). Thank you all so much for your help!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.