Pulling highlights from my e-reader

A long standing goal of mine is to pull highlights from my e-reader to display along with my notes in the /media section of this site. I switched from an Amazon Kindle Paperwhite to a Kobo Clara HD in order to make this easier.

You can see an example of what I mean here.

How it's done

On the device is a simple sqlite database which contains all of the annotations. I have a small node.js script to read from that database and output it to the JSON file, with the book title as the key.

Then in the page for each book I render a component and pass it the title of the book.

Gotchas

1. Page Numbers

It would be useful to display page-numbers along with the highlights, but kobo doesn't store them. Instead they have a startContainerPath field which contains something like span#kobo.56.4 I'll need to do some fo

2. Title formatting

I use calibre to manage my e-books. It defaults to standard "reference style" formatting of titles, i.e moving "the"'s to the end etc. More generally though the title stored in the database could differ from the title I have in the metadata for each book (as that's intended to be read).

Right now the solution is to just manually pass the title that's in the database, but this requires a little bit of ceremony with looking that up. Not a big deal I know, but something I'd like to automate if a straightforward quick solution comes to me.

built with nextjs, mdx, and typescript view source