Skip to content

Instantly share code, notes, and snippets.

@cbgoodman
Created January 6, 2026 18:57
Show Gist options
  • Select an option

  • Save cbgoodman/cccb91654c0930b1f4c83870efa8178a to your computer and use it in GitHub Desktop.

Select an option

Save cbgoodman/cccb91654c0930b1f4c83870efa8178a to your computer and use it in GitHub Desktop.
obsidian-zotero-import-template
Error in user YAML: (<unknown>): found character that cannot start any token while scanning for the next token at line 4 column 2
---
citekey: '{{citekey}}'
categories: "[[Literature]]"
title: '{{title | escape}}'
{%- set camelRegex = r/([a-z])([A-Z])/g %}
{%- for type, creators in creators | groupby("creatorType") %} 
{% if creators.length > 1 %}{{type | replace(camelRegex, "$1 $2") | lower | trim}}:{%- for creator in creators %}{% if creator.name %}
- '[[{{creator.name}}]]'{% else%}
- '[[{{creator.firstName}} {{creator.lastName}}]]' {% endif %}{%- endfor %} {% else -%}
{{type | replace(camelRegex, "$1-$2") | lower | trim}}:{%- for creator in creators %}{% if creator.name %} 
- '[[{{creator.name}}]]'{% else%} 
- '[[{{creator.firstName}} {{creator.lastName}}]]'{% endif -%}{%- endfor -%}{% endif -%}{% endfor %}
pubyear: '{{date | format("YYYY")}}'
type: '{{itemType}}'
publication: {%- if itemType == "journalArticle" %} '[[{{publicationTitle}}]]' {%- elif itemType == "Book" %} '{{title}}' {%- else %} '{{bookTitle}}'  {%- endif %}
doi: {% if DOI %}[https://doi.org/{{DOI}}]{% endif %}
ISBN: {% if itemType == "book" %}{{ISBN}}{% endif %}
topics: {% for t in tags %}
- '[[{{t.tag}}]]'{% if not loop.last %}{% endif %}{% endfor %}
related: {% for relation in relations | selectattr("citekey") %} 
- '[[{{relation.citekey}}]]'{% if not loop.last %}{% endif%} {% endfor %}
zotero: '{{desktopURI}}'
---

[!Citation]- {{bibliography}}

[!Abstract]- {{abstractNote}}

Notes

{%- if markdownNotes %} {{markdownNotes}}{%- endif -%}.

Annotations

{% persist "annotations" %}{% set annots = annotations | filterby("date", "dateafter", lastImportDate) -%}{% if annots.length > 0 %}

Important

{% for annot in annots -%}{% if annot.annotatedText and annot.color == "#2ea8e5" %}

Highlight {{annot.annotatedText}} (pg. {{annot.page}}) {#page link#} {% if annot.imageRelativePath %}![[{{annot.imageRelativePath}}]] {% endif %}{% if annot.comment %}{{annot.comment}}{%endif %} {% endif %}{% endfor %}

Look up

{% for annot in annots -%}{% if annot.annotatedText and annot.color == "#ffd400" %}

Highlight {{annot.annotatedText}} (pg. {{annot.page}}) {#page link#} {% if annot.imageRelativePath %}![[{{annot.imageRelativePath}}]] {% endif %}{% if annot.comment %}{{annot.comment}}{%endif %} {% endif %}{% endfor %}

Hypothesis

{% for annot in annots -%}{% if annot.annotatedText and annot.color == "#5fb236" %}

Highlight {{annot.annotatedText}} (pg. {{annot.page}}) {#page link#} {% if annot.imageRelativePath %}![[{{annot.imageRelativePath}}]] {% endif %}{% if annot.comment %}{{annot.comment}}{%endif %} {% endif %}{% endfor %}

Methodology

{% for annot in annots -%}{% if annot.annotatedText and annot.color == "#f19837" %}

Highlight {{annot.annotatedText}} (pg. {{annot.page}}) {#page link#} {% if annot.imageRelativePath %}![[{{annot.imageRelativePath}}]] {% endif %}{% if annot.comment %}{{annot.comment}}{%endif %} {% endif %}{% endfor %}

Disagrees

{% for annot in annots -%}{% if annot.annotatedText and annot.color == "#ff6666" %}

Highlight {{annot.annotatedText}} (pg. {{annot.page}}) {#page link#} {% if annot.imageRelativePath %}![[{{annot.imageRelativePath}}]] {% endif %}{% if annot.comment %}{{annot.comment}}{%endif %} {% endif %}{% endfor %}

Keywords, names, abbr.

{% for annot in annots -%}{% if annot.annotatedText and annot.color == "#a28ae5" %}

Highlight {{annot.annotatedText}} (pg. {{annot.page}}) {#page link#} {% if annot.imageRelativePath %}![[{{annot.imageRelativePath}}]] {% endif %}{% if annot.comment %}{{annot.comment}}{%endif %} {% endif %}{% endfor %}

General

{% for annot in annots -%}{% if annot.annotatedText and annot.color == "#aaaaaa" %}

Highlight {{annot.annotatedText}} (pg. {{annot.page}}) {#page link#} {% if annot.imageRelativePath %}![[{{annot.imageRelativePath}}]] {% endif %}{% if annot.comment %}{{annot.comment}}{%endif %}{% endif %} {% endfor %} {% endif %} {% endpersist %}

All notes

{% persist "annotations" %}{% set annots = annotations | filterby("date", "dateafter", lastImportDate) -%}{% if annots.length > 0 %} {% for annot in annots -%}{% if annot.annotatedText %}

Highlight {{annot.annotatedText}} (pg. {{annot.page}}) {#page link#} {% endif %} > {% if annot.imageRelativePath %} ![[{{annot.imageRelativePath}}]] {% endif %}{% if annot.comment %}{{annot.comment}}{%endif %} {% endfor %}{% endif %} {% endpersist %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment