Readwise to Obsidian export settings
These are settings for the Readwise-to-Obsidian export template settings page — with some additional context and explanation.
Jump straight into the configuration or keep reading for more context.
the goal (examples + context)
Here's the primary outcome I'm after — easily referenceable highlights that can be embedded in other notes, like this:
🔑 The key to making this happen is a block ID like ^rwhi1234567890
on the exported highlights. See this explanation. There's some other customization to the frontmatter and filename and such, but they're much less important.
Here's context about my current Readwise usage: readwise features and how i use them
I also strongly suggest: treat readwise exports as read-only
obsidian extension settings
Useful settings in the readwise obsidian plugin itself:
- base folder:
readwise/exports
- because then i can keep other files in
readwise
and just delete/syncreadwise/exports
as needed (treat readwise exports as read-only)
- because then i can keep other files in
- resync deleted files:
checked
- so it re-syncs files i delete in obsidian
the configuration
Sections ordered by how they appear on the Readwise-to-Obsidian export template settings page, but the highlight settings are definitely the most important of the configuration.
file name
Readwise's default export settings for filenames aren't sanitized to Obsidian's restrictions on filenames, so this snippet should help avoid most bad characters in the filenames:
{{ title|replace('@', '')|replace('#', 'no.')|replace('^', '')|replace('[', '(')|replace(']', ')')|replace('^', '')|replace(': ', ' - ')|replace(' | ', ' - ') }}
... because any backlinks referencing those files will be referencing the incorrect name upon a fresh sync. It's an easy fix, especially if you're using the ^rwid
block IDs from my #highlight config further down this note, so maybe do that first.
#
→ no.
is opinionated, but i am designing for my common case — numbered podcasts like Podcast Name (episode #123)
→ Podcast Name (episode no.123)
.
If you want to remove #
from a title altogether so it isn't replaced with no.
: how to edit Readwise document metadata
page title
# {{ title }}
page metadata
{% if image_url -%}
![rw-book-cover]({{image_url}})
{% endif %}
{% if document_note -%}
## Document note: {{document_note}}
{% endif -%}
highlights header
{% if is_new_page %}
## Highlights
{% endif -%}
highlight
{# this line adds a space between highlights #}
{# this line adds a space between highlights #}
{{ highlight_text }}{% if highlight_location and highlight_location_url %} ([via]({{highlight_location_url}})){% elif highlight_location %} ({{highlight_location}}){% endif %} ^rwhi{{highlight_id}}
{% if highlight_note %}
{{ highlight_note }} ^rwhi{{highlight_id}}-note
{% endif %}
rwhi
is meant to represent all r
eadw
isehi
ghlights, and the number that follows is the highlight's ID in Readwise's database. This is a convention I invented so the ^blockid
is always stable for referencing.
If the readwise highlight contains breaklines, they may not appear quite the same in Obsidian.
This is intentional because of how "blocks" work in markdown — the
^blockref
wouldn't work if there's actual breaklines.The solution is to style the
<br>
that Readwise uses in your Obsidian theme. Here's how I do that:
/* spacing for embeds */*
.internal-embed br {
margin: 1em 0;
display: block;
content: "";
}
/* increase <br> in reading mode */
.markdown-reading-view p br {
margin: 1em 0;
display: block;
content: "";
}
YAML front matter
aliases:
- "{{title}}"
title: "{{title}}"
{% if author %}author: "{{author}}"{% endif %}
{% if url %}url: "{{url}}"{% endif %}
{% if document_tags %}related to: {% for tag in document_tags %}
rw-category: "{{category}}"
- "[[{{tag}}]]"{% endfor %}{% endif %}
tags:
- artifact/readwise{% if category %}/{{category}}{{ "📚" if category == "books"}}{{"📰" if category == "articles"}}{{"🐦" if category == "tweets"}}{{"🎙" if category == "podcasts"}}{% endif %}
YAML frontmatter example:
🤷
no harm and can produce some interesting obsidian graph states or serve as a count of exported documents in my obsidian vault.
i also liked the idea that artifacts
represented a sort of read-only thing in my vault.
the emojis were just to try emojis in tags.