New plugin: Apple Books - Import Highlights

Hello community!

I’m happy to announce my contribution to the Obsidian plugins ecosystem - Apple Books - Import Highlights.

This plugin imports your highlights and passages from Apple Books to Obsidian.

Preview

The idea is not new, but this plugin has significant advantages over existing solutions:

  • Fast: It takes less than 1 second to import ~1000 highlights.
  • Customizable: Use Handlebars and Markdown to customize the output of your highlights the way you want. All the variables to use are available in the default template.
  • Reliable:
    • Import actual highlights with only the metadata you need. No visual noise with the deleted but still exported highlights, or, on the contrary, highlights and notes that make no sense without the context.
    • Back up your highlights before each import to avoid accidental data loss (optional, but recommended).
  • Dataview-ready: The default template creates highlights in a format that is compatible with Dataview, so you can use your highlights in Dataview queries to unleash possible use cases even further (for example, to create a list of books you’ve read).
  • Up-to-date: The plugin is updated regularly to support the latest versions of Obsidian, and Apple Books, as well as react to the users’ feedback.

How to use

  • Command palette: Cmd+P > Apple Books - Import Highlights: Import all highlights
  • Ribbon: Select the plugin icon in the Ribbon (left sidebar)

Side Notes

  • The only supported platform to perform import is macOS.
  • Currently, the plugin imports all highlights from all books in bulk. Importing highlights from a specific book is the major feature of the upcoming release.

Contributing

Your feedback and ideas are more than welcome and highly appreciated! Let’s have a discussion here!

In case of any issue, feel free to open an issue on GitHub

4 Likes

Nice work. This is really quick.

Is there a list of template variables that can be used to customise how the information is formatted?

Hi @cmyplay Thank you, I’m happy that you have a pleasant experience with the plugin. And thanks for your patience.

All the variables are available in the default template. It is mentioned in the documentation, but adding them explicitly would also be helpful. I will add it in the upcoming release. Thank you for the suggestion.

P.S: If you’ve already modified the template, you can back to the original one via “Reset template”.

UPD: @cmyplay You can find the full list of variables in the Template variables section of the README.

Had a thought considering you’ve just added the ability to import highlights of a specific book.

It might be of use to have the option (maybe a setting toggle) to be able to choose the order in which the highlights appear.

Some use cases that come to mind:

  • by Creation Date
  • by Last modified
  • sequentially in the book

Pushing this even further, if used regularly, it might be useful to have different templates (layouts) for each use case.

In which case, keeping the one default as is, perhaps each sort option could have a text field assigned to use a specific_template.md from the vault?

That’s yet another good feature request! Please submit an issue so we can align on expectations. Thank you!

It wouldn’t let me. That’s why I came here :slight_smile:

An owner of this repository has limited the ability to open an issue to users that are collaborators on this repository.

Damn, sorry about that :pensive: I modified the settings, you should be able to submit issues now.

HI, I just installed the plugin, which seems perfect for my needs, but I obviously got this error message, whatever vault and setup I try : Error while importing Apple books highlights.
Check console for details.

Have you heard of this issue ? Do you know how to overcome it ?

Thanks !

Hi, thanks for your interest in the plugin and sorry that your first experience wasn’t perfect. Let’s try fix this.

  1. Open your Obsidian vault where you want to use the plugin
  2. Press Command + Option + I to show the Developer Tools (or use app menu: View > Toggle Developer Tools).
  3. In the Developer Tools, select the Console tab
  4. Try to import highlights using the plugin.
  5. Copy here (or attach a screenshot) the error that you’re getting

Hi, thanks for reply. This is what I get in the console when trying to import highlights.

I get the same error.

@schiz0idandr0id @jdugarte Thanks for the feedback.
Please go to the plugin repo and submit a bug report, as I couldn’t easily reproduce the issue using the latest version of the plugin.
Thank you.

Hi there, @Bandantonio - I just wanted to say that I love your plugin. It’s exactly what I need with no frills.

One thing that would be helpful is the ability to define the range of the contextual text. Right now you’ve defined it to be the full sentence, but I would love to be able to adjust that - e.g. the user can ask for the sentence with the highlight, as well as the sentence before and after, or the paragraph.

Thank you!

@civilserf Thank you so much for the kind words, it’s great to hear that the plugin is exactly what you were looking for!

As for your suggestion, unfortunately, I believe it’s not possible, as the database contains only information about the exact location of a specific highlight and sentence this highlight is part of. And even if it was possible, it seems that having a lengthy contextual text can create a mess, especially for cases with two adjacent or closely located highlights within one paragraph. As a result, both highlights will be a part of each other’s contextual text, which may be confusing. For sure, having a “hard limit” to the current sentence may not be enough in some cases, but on the other hand, it is pretty much safe in terms of potential overlaps. Anyway, there is nothing we can do with this limit atm.

If you need more context, I would suggest highlighting as much as you need and then adding a note that aside from your own thoughts will contain the details about why you highlighted as much as you did.

P.S.: In Obsidian, I see book highlights only as a temporary reference (literature notes) that is there only until you transform all the thoughts they contain into new kinds of notes or supplement the existing notes.

Thanks @Bandantonio !!! Your plugin is super fast and useful!
I am pretty new to Obsidian so please forgive me for asking stupid questions. I can adjust your template to fit my taste but I got no luck with {{bookCoverUrl}}. I cannot create a link pointing to the URL. Any idea?

@weslau Thank you! I’m happy that my plugin gave you with a pleasurable experience.

As for your question (never be afraid of asking as there are no stupid questions - we’ve all been newbies in something at some point), could you please clarify what you mean by “cannot create a link…”? There is a high probability that bookCoverUrl may be empty in the database, so the variable returns nothing. If you’re having another case, please clarify further. Thank you.

P.S: @jun6lee, could you please show your example of a book with a non-empty bookCoverUrl?