· 2 min read

Readwise Exporting to Obsidian

Readwise Exporting to Obsidian

The Self Discovery Channel on YouTube

I post videos discussing software, creativity, media, and video essays and short films. Please subscribe!

The above video goes over Jinja templates and using them to customize your highlights from Readwise.io into your Obsidian vault and some tips to get the most out of exports and how highlights taken from Readwise proper and Reader differ.

Jinja Templating Engine


Readwise uses Jinja for manipulating the highlights and other data taken from the items you add to Readwise. Through Jinja you can use if/then statements and text filters to fine tune the way your Obsidian highlight notes look.

Obsidian Export Templates


File Name

{{title|replace("#", "")|replace(";"," -")}} - {{author}}

The first section will take the {{title}} variable from Readwise and replace all instances of "#" with "", effectively removing them then it will go through the modified version of the {{title}} variable and replace all ";" with " -". For me, these were the most common characters popping up that were causing issues with file names in Obsidian notes. Chaining more |replace filters will let you continue to swap or remove characters.

Page Metadata

{% if is_new_page %} {% if image_url -%} ![rw-book-cover|400]({{image_url}}) {% endif -%}{% endif -%}

The only change I made to the default value in this section is adding the '|400' after the embed image link. This will tell Obsidian to scale the image down to 400px width.

Highlights Header

{% if is_new_page %} > [!INFO]+ > categorization:: {% for tag in document_tags %}#Subject/{{tag}} {% endfor %} > classification:: #Source/{{"videos" if 'youtube.com' in url else category }} > author:: {% if author %}[[{{author}}]]{% endif %} > url:: {{url}} > date:: [[{{last_highlighted_date|date('Y-m-d')}}]] # Highlights {% elif has_new_highlights -%} ## New highlights added [[{{date|date('Y-m-d')}}]] {% endif -%}

Here we have a collapsible call out that will insert Obsidian tags (Starting with #Subject) for each Readwise tag added to the document. So tagging an article in Readwise as "Ghosties" will translate to a nested Obsidian tag of #Subject/Ghosties. For the #Source tag, which I use to track the type of item that is being highlighted, I have Readwise insert the type category that it internally uses unless the url of the item has 'youtube.com' in it. This is because Readwise's Reader app, that you can use to highlight transcripts of online video, does not translate t a 'video' category in Readwise proper, which is what is actually doing the exporting.

Highlight

> [!QUOTE]+ > {{ highlight_text|replace("#", "+") }}{% if highlight_location and highlight_location_url %} ([{{highlight_location}}]({{highlight_location_url}})){% elif highlight_location %} ({{highlight_location}}){% endif %} ^rw{{highlight_id}} {% if highlight_tags %} > [!IMPORTANT] Highlight Metadata > Tags: {% for tag in highlight_tags %}[[{{tag}}]] {% endfor %}{% endif %} {% if highlight_note %}> Note: {{ highlight_note|replace("#", "")|replace(":"," -") }}{% endif %}

YAML Front Matter

title: "{{title|replace("#", "")|replace(":"," -")}}" moment: <% tp.date.now("HH:mm:SS") %> icon: {{"📼" if 'youtube.com' in url else "📚" if category == "books" else "📰" if category == "articles" else "🐦" if category == "tweets" else "🎙" if category == "podcasts"}}

Sync Notification

I leave this disabled but I'm sure with some effort I could create a template for this note that would be useful in some way.

Read next

Wizordum Map Jam 1: The Tower Grounds
·

Wizordum Map Jam 1: The Tower Grounds

The 2023 retro fantasy first person shooter, Wizordum, held its first "Map Jam" event, encouraging players to use its in game level maker to create a map around a loose theme. Here is my entry, "The Tower Grounds", on mod.io and available in the in game Adventure browser.