renehernandez / obsidian-readwise

Sync Readwise highlights into your obsidian vault
MIT License
109 stars 7 forks source link
obsidian obsidian-md obsidian-plugin readwise

Obsidian Readwise (Community Plugin)

Obsidian Readwise (Community Plugin) is an unofficial plugin to synchronize Readwise highlights into your Obsidian Vault.

Note: This plugin requires a subscription with Readwise — a paid service that makes it easy to aggregate and review all your reading data into one place.

Features at glance

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:

You can find the details of these fields in the Readwise API docs, under the Books LIST section.

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:

You can find the details of these fields in the Readwise API docs, under the Highlight DETAIL section.

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.

Mapping of Authors

On plugin load, an authors.json file will be created (if not present), under the obsidian-readwise plugin folder (.obsidian/plugins/obsidian-readwise). There you can define mappings for Readwise author's field value. This will be applied only during the creation of new notes

Example mapping:

{
   "perell.com": "David Perell",
   "charity.wtf": "Charity Majors",
   "@david_perell on Twitter": "David Perell",
   "@mipsytipsy on Twitter": "Charity Majors"
}

The above mapping will be applied during the sync process for highlights from a new source (e.g a new article, book, tweets).

Settings

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.

Alternatives

In addition to this plugin, there is also another Readwise community plugin for Obsidian named Readwise Mirror, which can be found at: https://github.com/jsonMartin/readwise-mirror. Both plugins exist for different use cases, so please read below to determine which best suits your needs.

Roadmap

You can check the project Roadmap here

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

Compatibility

To check for the compatibility of different versions, check versions.json. All plugin versions newer than the highest specified in the versions.json file should be compatible with the same Obsidian version and newer.