# Personal Readwise Obsidian Export Format ## Customization [Customize in Readwise](https://readwise.io/export/obsidian/preferences) ### File Name [Documentation →](https://help.readwise.io/article/126-how-can-i-customize-the-readwise-to-obsidian-export#file-name) I added the first author to the name. Multiple authors are separated by `,<Space>` or `<Space>&<Space>`. ```jinja2 {% if author %}{{ author.split(' & ')[0].split(', ')[0]|replace('_', ' ')|replace(':', '')|replace('?', '')|replace('"', '')|replace('/', '')|replace('|', '')|replace('*', '')|replace('<', '')|replace('>', '')|replace('#', ' ') }}{% if ' & ' in author or ', ' in author %} et al.{% endif %} - {% endif %}{{title|replace('#', ' ')}} (Highlights) ``` ### Page Title [Documentation →](https://help.readwise.io/article/126-how-can-i-customize-the-readwise-to-obsidian-export#title) Keep title and file name consistent. ```jinja2 # {% if author %}{{ author.split(' & ')[0].split(', ')[0]|replace('_', ' ')|replace(':', '')|replace('?', '')|replace('"', '')|replace('/', '')|replace('|', '')|replace('*', '')|replace('<', '')|replace('>', '')|replace('#', ' ') }}{% if ' & ' in author or ', ' in author %} et al.{% endif %} - {% endif %}{{title|replace('#', ' ')}} (Highlights) ``` ### Page Metadata [Documentation →](https://help.readwise.io/article/126-how-can-i-customize-the-readwise-to-obsidian-export#metadata) All note-level metadata is exported in YAML frontmatter. Only the cover image and document note remain in the body. ```jinja2 {% if image_url -%} ![rw-book-cover|256]({{image_url}}) {% endif -%} {% if document_note %} ## Note {{ document_note|replace('↩︎', '') }} {% endif -%} ``` ### Highlights Header [Documentation →](https://help.readwise.io/article/126-how-can-i-customize-the-readwise-to-obsidian-export#header) ```jinja2 {% if is_new_page %} ## Highlights {% elif has_new_highlights -%} <!-- New highlights added {{date|date('F j, Y')}} at {{time}} --> {% endif -%} ``` ### Highlight [Documentation →](https://help.readwise.io/article/126-how-can-i-customize-the-readwise-to-obsidian-export#highlight) I added the anchor `^{{highlight_id}}` to allow [linking to a specific highlight in Obsidian](https://help.obsidian.md/How+to/Link+to+blocks#Link+to+blocks). [[Readwise Note Format Cheatsheet]] ```jinja2 {%- if highlight_text|length > 1 -%} - {% if highlight_text.startswith('↩︎') %}↩︎{% else %}{{ highlight_text.split('↩︎', 1)[0]|indent(1)|replace('␣', ' ') }}{% endif %}{% if highlight_location and highlight_location_url %} ([{{highlight_location}}]({{highlight_location_url}})){% elif highlight_location %} ({{highlight_location}}){% endif %}{% if highlight_note and highlight_note.startswith('^') %} {{highlight_note.split('\n',1)[0]}}{% else %} ^{{highlight_id}}{% endif %}{% if '↩︎' in highlight_text %} {{ highlight_text.split('↩︎', 1)[1]|trim|indent(1)|replace('␣', ' ') }} {% endif %}{% if highlight_tags %} {% for tag in highlight_tags %}#{{tag}} {% endfor %} {% endif %}{%- if highlight_note and ((not highlight_note.startswith('^')) or highlight_note.find('\n') >= 0)%} {% if not highlight_tags %} {% endif %} {% if highlight_note.startswith('^') -%} {{ highlight_note.split('\n',1)[1]|trim|replace('\n∎', '\n')|indent(1)|replace('␣', ' ') }} {%- else -%} {{ highlight_note|trim|replace('\n∎', '\n')|indent(1)|replace('␣', ' ') }} {%- endif %} {% endif -%} {% elif highlight_note %} {{ highlight_note.split('\n')|map('trim')|join('\n')|replace('\n∎', '\n')|replace('␣', ' ') }} {%- endif %} ``` Since the highlight is in the list, and the location and the anchor are appended to the end, the format is malformed if the highlight is a multiple line markdown block. I add a line `↩︎` before and `∎` after to fix the format. ^highlight-marks I also use `␣` to [[Keep the Leading Whitespaces in Readwise Highlights and Notes]]. The following is an example of how to format a code block with indentations in Readwise. ~~~markdown ↩︎ ```ruby def hello(name): ␣␣puts "Hello, #{name}" end ``` ∎ ~~~ ### YAML Front Matter [Documentation →](https://help.readwise.io/article/126-how-can-i-customize-the-readwise-to-obsidian-export#yaml-front-matter) Use lower kebab-case property names. `authors` is a list of wikilinks, or `null` when absent; `host`, `created`, and `highlighted` retain their wikilinks. `review` and `url` store plain URLs, and `icon` stores the category emoji for Pretty Properties. Export the classification tags `x` and `zettel/fleeting` in native `tags`, not `status` or `zettel` properties. Source, category, and document tags also remain in native `tags`; preserve their spelling and order without reinterpreting them as classification properties or adding a `kind/` prefix. Do not infer a kind from the Readwise category. Jinja's `tojson` filter produces YAML-compatible quoted values, safely preserving quotes, backslashes, Unicode, and multiline text. Disable Obsidian Publish for the `private` document tag and retain the thumb property. For this schema update, replace **YAML Front Matter** in the Readwise export settings. Keep the existing **Page Metadata**, highlight, and sync-notification settings unchanged. Readwise is append-only: changing these settings does not migrate existing notes or refresh their properties when new highlights arrive. In particular, `highlighted` remains the date from the note's initial export until explicitly updated. Do not reset or resync locally edited notes. ```jinja2 {% set document_tags = document_tags or [] -%} {% set source_tag = 'from/' ~ (source|lower|replace(' ', '-')) -%} {% set native_tags = ['x', 'zettel/fleeting', 'from/readwise', source_tag, category, 'readwise/' ~ category] + document_tags -%} {% if 'private' in document_tags -%} publish: false {% endif -%} {% if image_url -%} thumb: {{ image_url|tojson }} {% endif -%} review: {{ ('https://readwise.io/bookreview/' ~ book_id)|tojson }} {% if author -%} authors: {% for name in author.replace('_', ' ').replace(' & ', ', ').split(', ') -%} {{ ' - ' }}{{ ('[[' ~ name ~ ']]')|tojson }} {% endfor -%} {% endif -%} full-title: {{ full_title|tojson }} icon: {{ ({'books': '📚', 'articles': '📰', 'tweets': '🐦', 'podcasts': '🎙'}.get(category, ''))|tojson }} {% if url -%} url: {{ url|tojson }} host: {{ ('[[' ~ url.split('://')[-1].split('/')[0] ~ ']]')|tojson }} {% endif -%} {% if date -%} created: {{ ('[[' ~ date|date('Y-m-d') ~ ']]')|tojson }} {% endif -%} highlighted: {{ ('[[' ~ last_highlighted_date|date('Y-m-d') ~ ']]')|tojson }} tags: {% for tag in native_tags|unique(case_sensitive=true) -%} {{ ' - ' }}{{ tag|tojson }} {% endfor -%} ``` ### Sync Notification [Documentation →](https://help.readwise.io/article/126-how-can-i-customize-the-readwise-to-obsidian-export#notification) I use a level 1 heading so that the `Extract Heading` command can create a new note and merge its properties. ~~~jinja2 # Readwise Sync {{date|date('Y-m-d')}} ```obsidian-properties tags: - from/readwise created: "[[{{date|date('Y-m-d')}}]]" highlight-count: {{num_highlights}} file-count: {{num_books}} target-folder: "robot/Readwise Library/Readwise Syncs" ``` ## Files {% for book in books %}- {{ book.num_highlights_added}} in [[{% if book.author %}{{ book.author.split(' & ')[0].split(', ')[0]|replace('_', ' ')|replace(':', '')|replace('?', '')|replace('"', '')|replace('/', '')|replace('|', '')|replace('*', '')|replace('<', '')|replace('>', '')|replace('#', ' ') }}{% if ' & ' in book.author or ', ' in book.author %} et al.{% endif %} - {% endif %}{{ book.title|replace(':', '')|replace('?', '')|replace('"', '')|replace('/', '')|replace('|', '')|replace('*', '')|replace('<', '')|replace('>', '')|replace('#', ' ') }} (Highlights)]] {% endfor %} ~~~