Update (sorry it won’t let me edit the original post): I adjusted the code so that all the highlights are grouped together under the same quote
Here’s the updated template:
## Annotations
{% macro calloutHeader(color) -%}
{%- if color == "#a28ae5" -%}
Highlight - Purple
{%- endif -%}
{%- if color == "#2ea8e5" -%}
Reference to Read - Blue
{%- endif -%}
{%- if color == "#5fb236" -%}
Key Information - Green
{%- endif -%}
{%- if color == "#ff6666" -%}
Question - Red
{%- endif -%}
{%- if color == "#ffd400" -%}
Important - Yellow
{%- endif -%}
{%- endmacro -%}
{% persist "annotations" %}
{% set annotations = annotations | filterby("date", "dateafter", lastImportDate) -%}
{% if annotations.length > 0 %}
#### Imported on {{importDate | format("YYYY-MM-DD h:mm a")}}
{% for color, annotations in annotations | groupby("color") -%}
> [!quote|{{color}}] {{calloutHeader(color)}}
> {%- for annotation in annotations -%}
{%- if annotation.imageRelativePath %}
> ![[{{annotation.imageRelativePath}}]]
{%- endif %}
{%- if annotation.annotatedText %}
>{{annotation.annotatedText}} [(p. {{annotation.pageLabel}})](zotero://open-pdf/library/items/{{annotation.attachment.itemKey}}?page={{annotation.pageLabel}}&annotation={{annotation.id}}){%- endif -%}
{%- if annotation.comment %}
>
>> {{annotation.comment | nl2br}}{%- endif -%} <br>
{%- endfor %}
{% endfor -%}
{% endif %}
{% endpersist %}
And this is what it looks like now. Multiple highlights are now grouped together under the same admonition based on color.