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 Yesterday, 02:02 AM   #1
ReaderMoa
Junior Member
ReaderMoa began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Apr 2026
Device: Calibre
Direct annotations through CSS, is it practical?

I'm quite a fan of annotations but the fact that they don't really stay inside EPUB files sort of bugs me.

So how viable and safe is it to simply edit the CSS of the EPUB itself, through the Calibre EPUB Editor for instance, using a class like

```
.highlightgreen {
background-color: lightgreen;
}
```

Do you think it would be safe and is there a plugin that supports it? The methods most people mention don't involve editing the EPUB directly but using external metadata
ReaderMoa is offline   Reply With Quote
Old Yesterday, 08:57 AM   #2
lomkiri
Groupie
lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.
 
lomkiri's Avatar
 
Posts: 191
Karma: 1537710
Join Date: Jul 2021
Device: N/A
First of all, I guess you're aware that you can annotate an epub wjhen you're using the calibre's epub reader, annotations are stored inside the epub itself, in the "calibre_bookmarks.txt" file (in the prefs, choose miscellaneous / "Keep a copy of annotations/bookmarks in the e-book file, for easy sharing").

But, of course, they are readable only with the calibre's epub reader itself, not even the editor is understanding the content of the file calibre_bookmarks.txt.

If you want to be able to share the annotations with other people that don't use calibre, you're solution is possible, but it needs to write a plugin that, for example with a button on the toolbar, get the current selection and put it inside a span using the css class you've told (the same plugin would create this class at its first call in the current epub). So it's not a trivial solution.

Edit: Or another one that — using the code that Kovid already wrote in the ebook-viewer — would get the content of calibre_bookmarks.txt and put it inside the code of the epub.

Last edited by lomkiri; Yesterday at 11:18 AM.
lomkiri is offline   Reply With Quote
Advert
Old Yesterday, 10:16 AM   #3
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,664
Karma: 64144480
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
The CSS is where you create a STYLE that the book can use.
You would the need to add a span class= "highlightgreen"> around the annotation anchor text.
theducks is offline   Reply With Quote
Old Yesterday, 01:16 PM   #4
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,809
Karma: 9501034
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Quote:
Originally Posted by ReaderMoa View Post
I'm quite a fan of annotations but the fact that they don't really stay inside EPUB files sort of bugs me.

So how viable and safe is it to simply edit the CSS of the EPUB itself, through the Calibre EPUB Editor for instance, using a class like

```
.highlightgreen {
background-color: lightgreen;
}
```

Do you think it would be safe and is there a plugin that supports it? The methods most people mention don't involve editing the EPUB directly but using external metadata
Jumping between a kindle, libra, iBooks and pc when reading really destroyed any hope of reliable highlighting. So I use a similar method using the <mark> tag

<mark>
This is some text I need to highlight/annotate</mark>

My CSS
mark {
background-color: yellow;
}


https://developer.mozilla.org/en-US/.../Elements/mark

Last edited by Karellen; Yesterday at 01:48 PM.
Karellen is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Save annotations to a file in ebook viewer, then view these annotations in the browse Sys_eng Library Management 2 11-10-2023 09:41 PM
Libra 2 "Unable to import annotations as the annotations column has not been configured..." Liudprand Kobo Reader 2 07-29-2023 10:56 PM
Annotations: Capture/Convert Kobo-Kindle (uses OpenWith and Annotations Plugins) EnergyLens Related Tools 12 03-28-2020 01:04 PM
Pdf annotations and Kindle annotations BranMakMorn Calibre 0 06-25-2011 02:42 PM
css pseudo elements and adjacent combinators in extra css? ldolse Calibre 2 12-21-2010 05:09 PM


All times are GMT -4. The time now is 10:57 PM.


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