Skip to content

Instantly share code, notes, and snippets.

@jgeusebroek
Created December 29, 2022 20:40
Show Gist options
  • Save jgeusebroek/39b1294cfa1f5b0167b452ec938ca33b to your computer and use it in GitHub Desktop.
Save jgeusebroek/39b1294cfa1f5b0167b452ec938ca33b to your computer and use it in GitHub Desktop.
Readwise Obsidian export templates

File name

{{last_highlighted_date |date('Y-m-d')}} {{title|replace(""","")|replace(""","")|replace("'","")|replace("'","")|truncate(159)}} by {{author|replace("@","")|truncate(80)}}

Add date and sanitize filename.

Page Metadata

{% if image_url -%}
![rw-book-cover]({{image_url}})

{% endif -%}
## Metadata
- Author: {% if author %}[[{{author|replace("@","")}}]]{% endif %}
- Full Title: {{full_title}}
- Category: #{{category}}
{% if document_tags -%}
- Document Tags: {% for tag in document_tags %}[[{{tag}}]] {% endfor %}
{% endif -%}
{% if url -%}
- URL: {{url}}
{% endif -%}

Highlights Header

{% if is_new_page %}a
## Highlights
{% elif has_new_highlights -%}
## New highlights added {{date|date('F j, Y')}} at {{time}}
{% endif -%}

Highlight


> {{ highlight_text }}
{% if highlight_note %}
- [note] {{ highlight_note }}
{% endif %}
{% if highlight_location and highlight_location_url %} * [{{highlight_location}}]({{highlight_location_url}}){% elif highlight_location %} ({{highlight_location}}){% endif %}

YAML Header

cssclass: readwise
category: {{category}}
date: {{date|date('Y-m-d')}}
title: {{full_title|replace(":","-")}}
image: {{image_url}}
author: {% if author %}{{author|replace("@","")|replace(" on Twitter","")}}{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment