Readwise template: tags and notes as block properties

I have been using the official Readwise plugin and am generally quite happy with it. I am experimenting a bit with setting up some advanced queries and want to use block properties to annotate my notes with tags and other information, so I can query blocks by properties. The Readwise template generates blocks for each highlight, with tags and notes a sub-bullets, which complicates my queries. I would prefer the tags and notes to be block properties - i.e. directly under each highlight, without turning into sub-bullets. Does anyone know if there is a syntax notation for this?

1 Like

I am using Readwise Reader as my capture/read-later app.
In the app, I am able to annotate articles, videos, etc and by going to Notebook -> Export -> edit export template I was able to customize it to the following:

### {{ title }}
author:: {{ author }}
source:: {{ url }}
type:: [[content/article]]
tags:: {{ tags }}

{% for highlight in highlights %}
    - {{ highlight.content }}
    {% if highlight.tags %}tags:: {% for tag in highlight.tags %} {{ tag }} {% endfor %}{% endif %}
    {% if highlight.note %}> {{ highlight.note }}{% endif %}

{% endfor %}

It does something similar to what you described.
If you’re not talking about Read, but Readwise’s traditional export features, then it also has a template language, but the syntax is different and i have not played around with that one yet.

The language of the Readwise Logseq template looks similar to what you have there, with a few differences. This is what I have in the template for the highlights:

{{ highlight_text }} #card {% if highlight_location and highlight_location_url %} ({{highlight_location}}){% elif highlight_location %} ({{highlight_location}}){% endif %}
{% if highlight_tags %}
tags:: {% for tag in highlight_tags %}#[[{{tag}}]], {% endfor %}
{% endif %}
{% if highlight_note %}
note:: {{ highlight_note }}{% endif %}

What I don’t like is that this creates the tags and note content as sub-bullets under the highlight text block. What I want is to have them as properties of that text block. For some reason the Readwise export inserts a “-” in front of the tags:: and note:: lines, even though I haven’t specified them in the template.

I did some further experimentation and seem to have found the solution. This code works:

{{ highlight_text }} #card {% if highlight_location and highlight_location_url %} ([{{highlight_location}}]({{highlight_location_url}})){% elif highlight_location %} ({{highlight_location}}){% endif %}\ {% if highlight_tags %} tags:: {% for tag in highlight_tags %}#[[{{tag}}]], {% endfor %}{% endif %}\ {% if highlight_note %} note:: {{ highlight_note }}{% endif %}

Note the backslashes after the {% endif %} statements, and the removal of all linebreaks. It is a single line of code now. I don’t exactly know why this works, but it does.

Hi. I wanted to tag on a related question, given this thread is about custom readwise export.

My issue is that I want highlights to appear in logseq as block quotes. For this I added:

“> {{ highlight_text }}”

This only works, however, for any highlight content before a line or paragraph break. After this, it imports simply as text.

An example. The first and second paragraph are part of one highlight:


was in 2015 that leaked documents first revealed that the US fossil fuel giant ExxonMobil knew as far back as the 1970s about the “potentially catastrophic” science of climate change and the business threat it posed.

The internal documents, most of which the company had kept secret, contained not only an acknowledgement of the link between burning fossil fuels and rising global temperatures, but data-driven projections of just how much the climate was likely to change. (View Highlight)


Is it possible to setup the custom export to arrive in logseq as blockquotes for highlights that include more than one paragraph?

thanks for any help.

Thomas.

It may be worth experimenting with the backslash character. It seems to turn hard line breaks into ‘soft’ line breaks, comparable to shift+enter in Logseq. I am not sure, though, whether Readwise exports each paragraph separately, or as a single block, with the line-breaks hard-coded in.