From 692355d680207604ba815f1d5cd9aa21d0a2fc01 Mon Sep 17 00:00:00 2001 From: mgmeyers Date: Sat, 23 Apr 2022 11:12:51 -0700 Subject: [PATCH] Add docs on template includes --- docs/Templating.md | 22 +++++++++++++++++++--- manifest.json | 2 +- src/DataExplorerView.tsx | 2 +- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/docs/Templating.md b/docs/Templating.md index 60a9d3b..56d2ac8 100644 --- a/docs/Templating.md +++ b/docs/Templating.md @@ -40,6 +40,13 @@ And a basic annotation template: Please see the [Nunjucks docs](https://mozilla.github.io/nunjucks/templating.html#variables) for more detail on templating. +## Where do I store my templates? + +Templates can reside anywhere in your Obsidian vault. The path to the template is supplied in the import settings. + +![](Screen%20Shot%202022-04-23%20at%2010.54.56%20AM.png) + + ## How do I format lists of data? In the data explorer, you'll notice that annotations, tags, creators, and other values look something like: @@ -139,12 +146,21 @@ You can also use this to import only the annotations that were added since the l This would then allow you to add block IDs to annotations, edit annotations or annotation comments, and add additional notes to annotations. +## How do I include content from other markdown files -## Where do I store my templates? +Templates can be split into multiple files if that makes organization easier for you. You can include those files in your main template using obsidian links: -Templates can reside anywhere in your Obsidian vault. The path to the template is supplied in the import settings. +```markdown +{% include "[[link to markdown file]]" %} +``` -![](Screen%20Shot%202022-04-23%20at%2010.54.56%20AM.png) +**Note:** if you want to include other markdown files in a `for` loop, you need to use `asyncEach` instead of `for`: + +``` +{% asyncEach a in annotations %} +{% include "[[annotation template]]" %} +{% endeach %} +``` ## What custom nunjucks filters are available? diff --git a/manifest.json b/manifest.json index f2a4d91..d0a7c42 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-zotero-desktop-connector", "name": "Zotero Desktop Connector", - "version": "2.0.0", + "version": "2.0.1", "minAppVersion": "0.12.0", "description": "Insert citations, bibliographies, and notes directly from Zotero desktop.", "author": "mgmeyers", diff --git a/src/DataExplorerView.tsx b/src/DataExplorerView.tsx index b45ba37..9d28ee2 100644 --- a/src/DataExplorerView.tsx +++ b/src/DataExplorerView.tsx @@ -160,7 +160,7 @@ function TemplatePreview({ setTemplate(output ? output : null); } catch (e) { - setTemplateError(e); + setTemplateError(e.message); } };