[Item] 模板+Ob_Zotero联动流程,Better notes + pdf translate +zotero style +green frog 插件大串联 #611
Replies: 14 comments 18 replies
-
模版不能正常使用,粘贴过去 |
Beta Was this translation helpful? Give feedback.
-
感谢分享,让我的工作流程更加优化了,现在可以通过BN同步zotero和Ob中的文献笔记了,之前不经常使用BN做笔记就是因为做完之后与Ob中的笔记存在隔离,现在二者已经打通了,可以更加愉快地写文献笔记了。附上我修改后的适合我的需求的代码,zotero7同样可以使用。
这是包含IF显示的模板,必须在期刊标签字段有内容时才可以使用,否则会报错,效果如下 另外为了使没有期刊标签字段的条目也可以使用模板,另外建立了下面的模板
Tips:模板代码参考了下面的链接: 再次感谢大佬分享 |
Beta Was this translation helpful? Give feedback.
-
请问不同设备的图片同步是怎么解决的呀 |
Beta Was this translation helpful? Give feedback.
-
点赞,感谢分享~ |
Beta Was this translation helpful? Give feedback.
-
请问: |
Beta Was this translation helpful? Give feedback.
-
感谢感谢
…---原始邮件---
发件人: ***@***.***>
发送时间: 2023年11月11日(周六) 下午2:29
收件人: ***@***.***>;
抄送: ***@***.******@***.***>;
主题: Re: [windingwind/zotero-better-notes] [Item] 模板+Ob_Zotero联动流程,Better notes + pdf translate +zotero style +green frog 插件大串联 (Discussion #611)
我是zotero7,黑色背景,然后用的这个代码,虽然dataview我不会写就是了
${(() => {
const titleTranslation = topItem.getField("titleTranslation");
if (titleTranslation) {
return (${topItem.getField("date")}) ${topItem.getField("title")} (${titleTranslation});
} else {
return (${topItem.getField("date")}) ${topItem.getField("title")}
}
})()}
<a href="${{
async function getPDFLink(item) {
const att = await item.getBestAttachment();
if (!att || !att.isPDFAttachment()) {
return "";
}
key = att.key;
if (att.libraryID === 1) {
return zotero://open-pdf/library/items/${key};
} else {
groupID = Zotero.Libraries.get(att.libraryID).id;
return zotero://open-pdf/groups/${groupID}/items/${key};
}
}
sharedObj.getPDFLink = getPDFLink;
return await getPDFLink(topItem);
}}$">
🔗
💡 Meta Data
Author: ${topItem.getCreators().map((v) => v.firstName + " " + v.lastName).join("; ")}
Journal: ${topItem.getField('publicationTitle')} (Publication Date: ${topItem.getField("date")})
Journal Tags: ${ (() => { let tags = Zotero.ZoteroStyle.data.ztoolkit.ItemTree.fieldHooks.globalCache.getFieldHooks.PublicationTags("", true, true, topItem, undefined); const jsonStartIndex = tags.indexOf('{'); if (jsonStartIndex !== -1) { tags = tags.slice(jsonStartIndex); } let regex = /"(sci|sciif)":"([^"]+)"/g; let matches = tags.match(regex); <!-- Conditional statement: to prevent errors when unable to find division for dissertations, conference papers, etc. --> if (tags) { const keyValuePairs = JSON.parse(tags); const colors = ["#94635c", "#d0867b", "#dc796a", "#ba8f6c", "#c8825c", "#e78a59", "#e99d22", "#ce9335", "#ff945c"]; let out = ""; <!-- The division information uses easyscholar, there's a tutorial in zotero style --> for (const key in keyValuePairs) { if (key === "sci") { out += `<span style="color:#ffffff; background-color:${colors[0]}; padding:6px;">SCI ${keyValuePairs[key]}</span>&nbsp;`; } if (key === "sciif") { out += `<span style="color:#ffffff; background-color:${colors[2]}; padding:6px;">IF ${keyValuePairs[key]}</span>&nbsp;`; } if (key === "ccf") { out += `<span style="color:#ffffff; background-color:${colors[4]}; padding:6px;">CCF ${keyValuePairs[key]}</span>&nbsp;`; } if (key === "sciUp") { out += `<span style="color:#ffffff; background-color:${colors[6]}; padding:6px;">CAS ${keyValuePairs[key]}</span>&nbsp;`; } if (key === "ssci") { out += `<span style="color:#ffffff; background-color:${colors[8]}; padding:6px;">SSCI ${keyValuePairs[key]}</span>&nbsp;`; } if (key === "eii") { out += `<span style="color:#ffffff; background-color:${colors[1]}; padding:6px;">${keyValuePairs[key]}</span>&nbsp;`; } if (key === "pku") { out += `<span style="color:#ffffff; background-color:${colors[3]}; padding:6px;">PKU ${keyValuePairs[key]}</span>&nbsp;`; } if (key === "cssci") { out += `<span style="color:#ffffff; background-color:${colors[5]}; padding:6px;">${keyValuePairs[key]}</span>&nbsp;`; } if (key === "utd24") { out += `<span style="color:#ffffff; background-color:${colors[7]}; padding:6px;">${keyValuePairs[key]}</span>&nbsp;`; } if (key === "ft50") { out += `<span style="color:#ffffff; background-color:${colors[0]}; padding:6px;">${keyValuePairs[key]}</span>&nbsp;`; } if (key === "fms") { out += `<span style="color:#ffffff; background-color:${colors[2]}; padding:6px;">FMS ${keyValuePairs[key]}</span>&nbsp;`; } } return out; } })()} </td> </tr> <tr> <td style="padding:8px;"> <b>Local Link: </b> <a href=zotero://open-pdf/0_${Zotero.Items.get(topItem.getAttachments()).filter((i) => i.isPDFAttachment())[0].key}> ${Zotero.Items.get(topItem.getAttachments()).filter((i) => i.isPDFAttachment())[0].getFilename()} </a> </td> </tr> <tr> <td style=" padding:8px;"> ${(() => { const doi = topItem.getField("DOI"); if (doi) { return `<b>DOI: </b><a href="https://doi.org/${topItem.getField('DOI')}">${topItem.getField('DOI')}</a>`; } else { return `<b>URL: </b><a href="${topItem.getField('url')}">${topItem.getField('url')}</a>`; } })()} </td> </tr> <tr> <td style="padding:8px;"> ${(() => { const abstractTranslation = topItem.getField('abstractTranslation'); if (abstractTranslation) { return `<b>Abstract Translation: </b><i>${abstractTranslation}</i>`; } else { return `<b>Abstract: </b><i>${topItem.getField('abstractNote')}</i>`; } })()} </td> </tr> <tr> <td style=" padding:8px;"> <b>Note Date: </b>${new Date().toLocaleString()} </td> </tr>
📜 Research Core
Tips: What was done, what problem was solved, innovations and shortcomings?
⚙️ Content
💡 Innovations
🧩 Shortcomings
🔁 Research Content
💧 Data
👩🏻💻 Method
🔬 Experiment
📜 Conclusion
🤔 Personal Summary
Tips: What aspects did you question, how do you think it can be improved?
🙋♀️ Key Records
📌 To be resolved
💭 Thought Inspiration
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
各位前辈,本人编程小白,想要学会自己更改模版,需要学习哪些知识?我基本是零基础。这个模版我黏贴好后,使用时显示topitem not defined我都不知道如何处理。 |
Beta Was this translation helpful? Give feedback.
-
大佬,用better note把笔记从Zotero导出到Obsidian后,标题会有一串代码,有什么办法可以消除吗 |
Beta Was this translation helpful? Give feedback.
-
大佬打算配适zotero7吗 |
Beta Was this translation helpful? Give feedback.
-
魔改的zotero 7代码,有许多细节还需修改。
|
Beta Was this translation helpful? Give feedback.
-
默认文件名[ExportMDFileNameV2]中的data建议修改为year。
|
Beta Was this translation helpful? Give feedback.
-
作者您好,我按照您的修改了ExportMDFileNameV2模板,但现在出现了双向同步报错,不知道您是否也碰到了这个问题? |
Beta Was this translation helpful? Give feedback.
-
反斜杠可以在导出的时候用正则替换,我这里因为markdown表格里可能会出现"|"导致表格无法正常显示,所以把所有的|和|\都给替换成|;
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Obsidian是markdown笔记管理工具、Zotero作为强大的文献管理工具,它们都有着大量活跃开发者提供各式插件,高度灵活,开源免费,是各自领域的集大成者。而且他们都将数据保存在本地,意谓着数据都自己掌控,还能自由同步。
Better Notes有着真正的双向同步机制,因此我觉得以此插件为基础,可以实现大众需求的笔记同步。于是我探索了相关流程,分享给大家,抛砖引玉。
前言
过去,根据相关教程,网友们探索了多种联动方案,比如我先前的流程:
然后后续就在Ob里做笔记,然而这个方案无法同步笔记里的图片,也不能双向同步。
但是基于Zotero Better Notes,可以解决这两个问题。同步笔记里的图片并且双向同步
Zotero Better Notes差异合并(Diff-Merge)
后来发现Zotero有个强大的笔记插件,叫 Zotero Better Notes, 其中笔记导入为markdown并可以实现双向同步,其同步策略官方说明如下:
同步检查有多种可能触发:
请注意同步检查并不意味着触发一次同步。仅当检测到外部Markdown或笔记产生修改时,才会开始同步。

在上述同步管理窗口中可设置自动同步周期,默认为30s。如果设置数值小于0,则不会自动同步。
绝大多数情况下,笔记与Markdown的编辑能够自动同步。如果自从上一次同步以来,Zotero笔记与外部Markdown文件都进行了编辑,则可能会进入差异合并阶段。
在此时,会弹出差异合并窗口,由用户手动选择需要保留的编辑。
上方信息栏显示当前正在比较的笔记及对应Markdown文件信息;
左侧是修改选择栏,可以多选数个要接受的编辑。中间为笔记的HTML(raw)格式的差异比较,红色为相较上次同步后笔记内删除的内容,绿色为相较上次同步后笔记内新增的内容。右侧为实时预览栏,根据左侧修改选择的情况实时预览编辑合并后的笔记。
点击Finish来保存合并,点击Unsync将会取消合并并且不再同步该笔记,点击Skip跳过本次比较。
由以上说明可以知道,Better Notes有着真正的双向同步机制,因此我觉得以此插件为基础,可以实现大众需求的笔记同步。
于是我探索了相关流程,分享给大家,抛砖引玉。
展示
Zotero里
Obsidian里
其中File是链接到zotero pdf,可以跳转打开Zotero

Ob Dataview展示
相关插件及配置
Zotero 6.0.26
Obsidain 1.3.4
流程配置
Better Notes设置模板
Better Notes有几个重要的模板需要设置,相关模板设置参考了多个模板项目,在此致谢:
[Item] A template including Year_First creator_Title and outline for EE students · windingwind/zotero-better-notes · Discussion #581 (github.com)
[item] 显示期刊标签的笔记模板示例 · windingwind/zotero-better-notes · Discussion #521 (github.com)
[Item] SCI论文阅读模版-new,自用生物医学类SCI笔记模板 · windingwind/zotero-better-notes · Discussion #501 (github.com)
[Item] SCI论文阅读模版 · windingwind/zotero-better-notes · Discussion #339 (github.com)
修改ExportMDFileNameV2
一个是
ExportMDFileNameV2
模板,按官方的模板导出的md文件名是这个样子的:“ 标题: MRI-Based Metastatic Nodal Number and Associated Nomogram Improve Stratification of Nasopharyngeal Carcinoma Patients: Potential Indications for Individual Induction Chemotherapy“
但是我希望尽量简短一些,比如Author+Year+title[前4个词]
于是修改这里的模板
添加 [Item] SCI论文阅读模版-noHtml模板
然后由于我们要插入各种字段,于是需要自定义显示:
Zotero style
获取带颜色的IF stylegreen frog
,它把数据保存到extra
字段extra
字段里,经过大量努力,把extra里的数据全部单独获取到了。archive
存档 字段中,当作ShortNote
备注这是我的模板
复制,然后剪切板导入
然后就可以创建笔记了,相关教程看Better notes官方文档: 4.2 笔记模板/Note Template (yuque.com)
Better Notes设置同步
Better Notes设置同步,保存到ob的库里面


Obsidian dataview展示
打开ob,现在已经可以看到笔记了,但是没有dataview卡片展示,这个其实可有可无,但是还是分享给大家。教程来源: How to use Minimal Theme's Cards View on Any Other Theme in Obsidian - YouTube
我用的
Topaz
主题,没有把dataview table显示成卡片的功能,需要css,配置css创建文件
Minimal Theme cards.css
,粘贴进css代码而后,创建dataview,在yaml中键入相关代码:
正文键入相关代码,其中
test
文件夹是你数据库中的文献文件夹然后就可以像开头展示的那样了,并且可以双向同步
存在的问题
当然,这个工作中仍然存在一些问题
\
我没有找到好办法处理,把流程分享给大家,也是想集思广益,解决流程中的问题。
Beta Was this translation helpful? Give feedback.
All reactions