Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 07-17-2026, 04:21 AM   #1
Siavahda
Addict
Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.
 
Posts: 208
Karma: 9400
Join Date: Aug 2010
Location: Helsinki
Device: Kobo Clara Colour
Quick simple way to remove <a> ids?

I have an EPUB that's scattered through with apparently random <a id>s, which wouldn't bother me except the marked text shows as underlined on my Kobo.

Is there some way to do a search and replace, or something similar, to get rid of them all at once? Obviously each ID is unique, so I can't think of any other way to get rid of them other than manually, one by one. Which is a literal pain, since my disabled hands can't handle that much clicking.

Each ID number/string of letters appears in the stylesheet like so

.calibre25 {
-aw-bookmark-end: _Hlk91081997;
}

I tried deleting those rules (ie removing calibre25 from the stylesheet), but that did nothing. I tried removing the id number itself from the rules (so calibre25 was just empty), but nope. Obviously if I do a search and replace for <a id=> what I'm left with is a bunch of things like this <_Hlk91081997>, which then appear like that in the html and would still need to be manually removed individually. Using the remove unused css rules or the beautify all files tools didn't help either.

Converting to DOCX and then back to EPUB worked, in that it got rid of the <a>s, but it messed up a lot of the other formatting.

If you have an idea, please explain like I'm 5, I'm not super tech-savvy!
Siavahda is offline   Reply With Quote
Old 07-17-2026, 04:29 AM   #2
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,884
Karma: 9600930
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Find: <a id=".*?">
Replace: leave it blank

Set your search mode to Regex and All text files.
step through a couple one at a time to make sure it works as expected, then use Replace All if it is working correctly.
Don't know where the calibre25 comes from or how it fits into it.
Karellen is offline   Reply With Quote
Advert
Old 07-17-2026, 04:55 AM   #3
Siavahda
Addict
Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.Siavahda can eat soup with a fork.
 
Posts: 208
Karma: 9400
Join Date: Aug 2010
Location: Helsinki
Device: Kobo Clara Colour
Quote:
Originally Posted by Karellen View Post
Find: <a id=".*?">
Replace: leave it blank

Set your search mode to Regex and All text files.
step through a couple one at a time to make sure it works as expected, then use Replace All if it is working correctly.
Don't know where the calibre25 comes from or how it fits into it.
Thank you so much, that worked perfectly!

RE calibre25: I had no idea what might be relevant, so I was trying to provide as much info as possible, is all.
Siavahda is offline   Reply With Quote
Old 07-17-2026, 05:39 AM   #4
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 84,211
Karma: 153715495
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Even easier is to use Diaps Editing Toolbag in the calibre editor.
JSWolf is offline   Reply With Quote
Old 07-17-2026, 06:16 AM   #5
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,884
Karma: 9600930
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Great! Glad it worked.
Karellen is offline   Reply With Quote
Advert
Old 07-17-2026, 10:45 AM   #6
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,889
Karma: 64184592
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
I clean the CSS (what you showed) entry of any -aw-bookmark (there are start and end types)
Code:
\.calibre\d+ \{\s+\-aw\-bookmark\-.+?: .+?\s+\}
those with:
any calibre number {
any that start with the phrase
}
theducks is offline   Reply With Quote
Old 07-17-2026, 01:48 PM   #7
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 53,208
Karma: 181177243
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by theducks View Post
I clean the CSS (what you showed) entry of any -aw-bookmark (there are start and end types)
Code:
\.calibre\d+ \{\s+\-aw\-bookmark\-.+?: .+?\s+\}
those with:
any calibre number {
any that start with the phrase
}
Would that not still leave the <a..>...</a> in the text portion? Remember that by default, an ePub underlines and uses blue for a link.

I'm using Sigil so I delete all the -aw-bookmark items from the CSS, remove unused from the text and then use the editing toolbox to remove any naked <a> tags.

Last edited by DNSB; 07-17-2026 at 01:53 PM.
DNSB is offline   Reply With Quote
Old 07-17-2026, 01:50 PM   #8
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 53,208
Karma: 181177243
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by Karellen View Post
Don't know where the calibre25 comes from or how it fits into it.
When the book was converted to ePub, calibre put every bookmark into the CSS with calibrexxx.
DNSB is offline   Reply With Quote
Old 07-17-2026, 02:45 PM   #9
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,884
Karma: 9600930
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Quote:
Originally Posted by DNSB View Post
When the book was converted to ePub, calibre put every bookmark into the CSS with calibrexxx.
Yuk. The css must be immense.
Would running "remove unused css rules" clean it all out?
Karellen is offline   Reply With Quote
Old 07-17-2026, 04:40 PM   #10
slm
(who/what)
slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.slm ought to be getting tired of karma fortunes by now.
 
Posts: 578
Karma: 5500000
Join Date: Feb 2003
Device: Kindle: Voyage,PW1,KOA, Kobo: Clara Colour, Nook GLP, Pocketbook verse
It may be worth noting that you can set up Calibre's file conversion to remove all <a> tags: In "the "Look and Feel" part go to the "Transform HTML" tab (last tab.
Add a rule that sets "If the tag name is" to "a" and select "remove tag only" as the action.

Its always amazing how much is packed into Calibre!
slm is offline   Reply With Quote
Old 07-17-2026, 05:32 PM   #11
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 53,208
Karma: 181177243
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by Karellen View Post
Yuk. The css must be immense.
Would running "remove unused css rules" clean it all out?
No when calibre creates those rules, they are being used. What I do is use a regex to remove all the rules from the stylesheet and then remove all unused rules from the text and lastly remove all <a> tags.

That is one reason I personally preferred to use KindleUnpack to convert azw3/KF8 to ePub.

Last edited by DNSB; 07-17-2026 at 05:41 PM.
DNSB is offline   Reply With Quote
Old 07-17-2026, 05:35 PM   #12
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 53,208
Karma: 181177243
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by slm View Post
It may be worth noting that you can set up Calibre's file conversion to remove all <a> tags: In "the "Look and Feel" part go to the "Transform HTML" tab (last tab.
Add a rule that sets "If the tag name is" to "a" and select "remove tag only" as the action.

Its always amazing how much is packed into Calibre!
The problem is that you would need a rule for every ID for a bookmark in the book. Removing all the <a whatever> tags would be a baby/bathwater situation.
DNSB is offline   Reply With Quote
Old 07-17-2026, 06:57 PM   #13
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 84,211
Karma: 153715495
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by slm View Post
It may be worth noting that you can set up Calibre's file conversion to remove all <a> tags: In "the "Look and Feel" part go to the "Transform HTML" tab (last tab.
Add a rule that sets "If the tag name is" to "a" and select "remove tag only" as the action.

Its always amazing how much is packed into Calibre!
If the eBook has footnotes, they get blown away. If the book has links from an index, that gets blown away. Any other valid links l=such as the HTML Toc (if you want to keep it) gets blown away and you are left with just a text list.

So don't do this or you could ruin the eBook.
JSWolf is offline   Reply With Quote
Reply

Tags
calibre, css


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick question about IDs Joliet Jake Library Management 15 09-19-2023 07:37 PM
Quick way to remove multiple libraries? Rellwood Library Management 2 06-19-2022 06:14 PM
Bulk remove Book IDs BetterRed Calibre 2 10-30-2013 03:47 AM
Simple and quick tool to convert epub to mobi? (on Mac!) FlorenceArt Kindle Formats 35 12-12-2012 03:37 AM
Quick way to fix simple things in mobi nounlu Kindle Formats 10 08-31-2010 04:14 PM


All times are GMT -4. The time now is 04:58 AM.


MobileRead.com is a privately owned, operated and funded community.