Skip to content

Guide: Advanced atomizer examples

Johann Richard edited this page Nov 2, 2025 · 3 revisions

Some ideas:

  • Use a highlight tag and template logic for conditional atomize blocks to limit atomization to individual highlights,
  • Use doc.linktext field for advanced filenames (e.g. by setting basename="{{doc.linktext}} ({{id}})"),
  • Keeping some info in the parent note (e.g. the "note") while atomising only the highlight itself.

Atomize individual highlights

The atomizer is a versatile extension to the Readwise mirror plugin that allows you to control at a very general or very granular level what to atomize. The following example requires that conditional atomizing is enabled in the settings (under Highlights). By using conditional logic for the highlight template, we can trigger the atomic notes based on highlight properties like tags, existence of a note and more.

The following examples for the frontmatter and highlights template will create atomic highlight notes for all highlights that have an atomic tag. It will embed these notes in the note for the readwise doc, together with all the other highlights which will remain part of this parent note.

Frontmatter template

This will set rw-atomize to true if any highlight has the atomize tag set, by using the highlight_tags variable in the frontmatter template. It triggers the conditional atomizer on every Readwisedoc matching this condition.

{%- if 'atomize' in highlight_tags %}
rw-atomize: true
{%- endif %}

Highlights template

The following highlight template will use an if block to render the %%! atomize !%% block only if the highlight has the atomize tag set. Make sure to not forget the closing condition as well.

{%- if 'atomize' in tags %}
%%! atomize 
  id={{ id }}, 
  basename="hl-{{ doc.id }}-{{ id }}", 
  embed=true !%%
%%! frontmatter !%%
{% endif -%} 
title: {{ doc.title | fme }} %%% This would render the title of the parent book %%%
type: {{ ["highlight", "foo:bar"] | fme }}
note: {{ note | qa | fme }}
highlight: {{ text | replace('__', '==') | fme }} 
tags: [{{ tags | replace('#', '') }}] {# This will render the tags #}
parent_note: "[[{{ doc.linktext }}]]" {# This will include a backlink to the parent note in the frontmatter #}
%%! endfrontmatter !%%

{#- Highlight template that does a few things:
  - Convert Readwise's "Highlight" syntax (__Highlight__) to Obsidian Highlight Syntax (==Highlight==)
  - Link to the Source and to the Highlight in Readwise 
  - Add block-id's both for the highlight and the note (Please be aware that line breaks, lists etc. in a note might create multiple blocks and referencing the "block-id-note" block might only link to the last block of the note.
#}
{#- Example template using both filters #}
{%- if note | is_qa %}
{{ note | qa }}
^{{ id }}-note

**Original Highlight:** 
> [!quote]
> {{ text | bq | replace('__', '==') }}  
{%- if locationUrl %}
> (*Original*: [{{ location }}]({{ locationUrl }})){%- endif %}
{%- if location_url %}
> (*Original*: [{{ location }}]({{ location_url }})){%- endif %}
^{{ id }}

{%- else %}
> [!quote]
> {{ text | bq | replace('__', '==') }}  
{%- if locationUrl %}
> (*Original*: [{{ location }}]({{ locationUrl }}))
{%- endif %}
{%- if location_url %}
> (*Original*: [{{ location }}]({{ location_url }})){%- endif %}
^{{ id }}
{%- if note %}
{{ note }}
^{{ id }}-note
{%- endif %}
{%- endif %}
{%- if 'atomize' in tags %}
%%! endatomize !%%
{% endif -%}
Clone this wiki locally