Zotlit can`t renderYaml

I’ve encountered a difficulty in Obsidian. When I use Zotlit, some literature can be converted into notes and displayed in Obsidian, but for some literature, an error appears: “failed to render Yaml”. I’ve tried many times but couldn’t solve it. I’ve even reinstalled it, but it didn’t work. Attached is my template.

What I’m trying to do

Things I have tried

zt-annot.eta
<% const label = {
“yellow”: “背景”,
“red”: “研究方法”,
“green”: “创新性”,
“blue”: “结论”,
“purple”: “相关知识”,
“magenta”: “局限性”,
“orange”: “可以思考的东西”,
“gray”: “不理解”,
};

let noteLabel = label[it.colorName] ? label[it.colorName] : ‘Note’;
%>

[!<%= noteLabel %>] Page <%= it.pageLabel %>

<%= it.imgEmbed %><%= it.text %>
<% if (it.comment) { %>

<%= it.comment %>
<% } %>

zt-annots.eta
<% const byColor = Object.groupBy(it, (annot) => annot.colorName);
const label = {
“yellow”: “背景”,
“red”: “研究方法”,
“green”: “创新性”,
“blue”: “结论”,
“purple”: “相关知识”,
“magenta”: “局限性”,
“orange”: “可以思考的东西”,
“gray”: “不理解”,
};
// Merge colors with customized label with unexpected colors, if any
// Keep the order of the colors from the original color-label map
const colorSet = new Set([…Object.keys(label), …Object.keys(byColor)]);
for (const color of colorSet) {
if (!(color in byColor)) continue -%>

<%= label[color] ?? color %>

<%_ for (const annot of byColor[color]) { %>

<%~ include(“annotation”, annot) %>
<%_ } %>
<% } %>

zt-cite.eta
[<%= it.map(lit => @${lit.citekey}).join("; ") %>]

zt-cite2.eta
<%= it.map(lit => @${lit.citekey}).join("; ") %>

zt-colored.eta
<%= it.content %>

zt-field.eta

title: “<%= it.title %>”

citekey: “<%= it.citekey %>”

tags: [paper, <% = it.tags.filter(t => t.name && t.name.startsWith(‘#’)).map(t => ‘"’ + t.name.slice(1) + ‘"’).join(', ') %>]

cate: 论文

concepts: [<%
let excludeEndings = [‘更新’, ‘推荐’, ‘关联’, ‘检索’, ‘未读’, ‘初读’, ‘精读’, “星标”]; // 定义不希望出现的字符串列表
let filtered_Tags = it.tags.filter(t =>
t.name &&
!t.name.startsWith(‘#’) &&
!excludeEndings.some(ending => t.name.endsWith(ending)) // 检查标签名是否以列表中的任何字符串结尾
).map(t => ‘"’ + t.name + ‘"’); // 转换为带引号的标签名
%> <%= filtered_Tags.join(', ') %> <% // 使用逗号连接所有筛选后的标签
%>]

read: <% let endings = [‘未读’, ‘初读’, ‘精读’]; let filteredTags = it.tags.filter(t => t.name && endings.some(ending => t.name.endsWith(ending))); if (filteredTags.length === 1) { %> “<%= filteredTags[0].name %>” <% } else if (filteredTags.length > 1) { %> 错误:存在多个符合条件的标签。 <% } else { %> 错误:没有找到符合条件的标签。 <% } %>

source: <% let endings_2 = [‘更新’, ‘推荐’, ‘关联’, ‘检索’]; let filteredTags_2 = it.tags.filter(t => t.name && endings_2.some(ending => t.name.endsWith(ending))); if (filteredTags_2.length === 1) { %> “<%= filteredTags_2[0].name %>” <% } else if (filteredTags_2.length > 1) { %> 错误:存在多个符合条件的标签。 <% } else { %> 错误:没有找到符合条件的标签。 <% } %>

authors: [<%= it.authors %>]

journal: <%= it.publicationTitle %>

paper_date: <%= it.date %>

date: <%= (new Date(it.dateModified || Date.now())).toISOString().slice(0, 10) %>

<%

let isImportant = it.tags.some(t => t.name === ‘:star2:星标’);

%>

important: <%= isImportant ? ‘True’ : ‘False’ %>

abstract: “<%= it.abstractNote %>”

zt-note.eta

<%= it.title %>

Zotero File Journal
Zotero <%= it.fileLink %> <%= it.publicationTitle %>

[!Abstract]

<%= it.abstractNote %>


Annotations

<%~ include(“annots”, it.annotations) %>

THIS IS MY TEMPLATE, I REALLY NEED TO DEAL WITH IT, THANK YOU

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.