Skip to content

Sync Readwise highlights into your obsidian vault

License

Notifications You must be signed in to change notification settings

Zowie/obsidian-readwise

 
 

Repository files navigation

Obsidian Readwise (Community Plugin)

An experimental plugin to synchronize Readwise highlights into your Obsidian Vault.

Features at glance

  • Sync highlights on Obsidian startup
  • Update existing notes with new highlights
  • Customization for note header and highlights through templating

Usage

After installation, it will ask for an API token. This is required in order to pull the highlights from Readwise into your vault.

If you don't configure the API token on installation, you can always configure it on the Settings section.

NOTE: The token is stored using localStorage and it may have conflicts if the same vault were to be open on 2 different windows.

Commands

Readwise: Sync highlights: Will pull any new highlights from Readwise since the last time it was synced.

Templating

The plugin supports templating the header of a note and each individual highlight. Templates are only evaluated during note creation and when adding new highlights.

The templating system in use is Nunjucks.

Header Template

The default header template is:

- **URL:** {{ source_url }}
- **Author:** {{ author }}
- **Tags:** #{{ category }}
- **Date:** [[{{ updated }}]]
---

This can be overwritten by configuring the Custom Header Template Path setting to the path of a different template. The available parameters for a custom header template are:

  • title
  • source_url
  • author
  • category
  • updated
  • num_highlights

Highlight Template

The default highlight template is:

{{ text }} %% highlight_id: {{ id }} %%
{%- if note %}
Note: {{ note }}
{%- endif %}

This can be overwritten by configuring the Custom Highlight Template Path setting to the path of a different template. The available parameters for a custom highlight template are:

  • text
  • note
  • id
  • location

If the custom highlight template doesn't include highlight_id: <id>, then this will be appended at the end of the rendered content as %% highlight_id: <id> %% ( will be replaced by the actual highlight's id).

Note: You can find examples of custom templates under tests/data folder.

Settings

  • Readwise API Token: Add/update your Readwise API token.
  • Sync on startup: If enabled, will sync highlights from Readwise when Obsidian starts
  • Custom Header Template Path: Path to template note that overrides how the note header is written
  • Custom Highlight Template Path: Path to template note that overrides how the highlights are written
  • Disable Notifications: Toggle for pop-up notifications

How the sync process work

The plugin will sync from Readwise only the new highlights since the last time it was executed (or since it was installed). The process works as follows:

  1. Check if there is a file with the same name (it checks for notes in top level of the vault only. Issue #22 tracks expanding support for customizing the location.
    1. If not, it creates a new file using the template from Custom Note Header Template or the default template.
  2. Read the content of the note, and add the highlights if they are not found. The search for highlight is based on the highlight_id from Readwise and not the text of the highlight. The exact match the plugin looks for is of the form highlight_id: <id> where is the actual id of the current highlight being rendered.

Installation

From within Obsidian

You can install this plugin from Settings > Community Plugins > Readwise.

Manual installation

Download zip archive from GitHub releases page. Extract the archive into <vault>/.obsidian/plugins.

Limitations

  • It can only pull the most recent 1000 highlights from Readwise (should be solved eventually as part of the implementation for this issue: issues/7

Compatibility

This plugin is being tested with Obsidian v0.11.9 and up

About

Sync Readwise highlights into your obsidian vault

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 96.6%
  • JavaScript 1.9%
  • Svelte 1.5%