從 Zotero 批注到Obsidian 研究筆記
https://publish.obsidian.md/history-notes/From+Zotero+Annotations+to+Obsidian+Research+Notes

Elena Razlogova
康科迪亞大學(xué)歷史系,蒙特利爾
elena.razlogova[at]concordia.ca
zach繪圖.png
歡迎來到 "用 Zotero 和Obsidian 做歷史"! https://publish.obsidian.md/history-notes/00+About+the+Project 了解更多關(guān)于這個(gè)項(xiàng)目的信息,或者在這里詳細(xì)閱讀設(shè)置情況。你也可以從Github上下載一個(gè)Obsidian 歷史庫的啟動(dòng)庫 https://github.com/erazlogo/obsidian-history-vault,其中預(yù)裝了這里描述的所有Obsidian 插件。
做筆記是研究和寫作的一個(gè)重要方面。特別是歷史學(xué)家的筆記規(guī)模很大:他們?cè)趯憰鴷r(shí)要處理成百上千的原始資料。你可以從索引卡和軟木板(corkboard)開始。但是,一旦你進(jìn)入一個(gè)重要的歷史項(xiàng)目,你可能會(huì)被各種來源和聯(lián)系所淹沒,而一個(gè)軟木板是不夠的。在這個(gè)階段,數(shù)字工具變得至關(guān)重要。
我選擇 Zotero 和 Obsidian 作為數(shù)字記事本,因?yàn)樗鼈冊(cè)谌腴T階段是免費(fèi)的,而且其付費(fèi)功能也不貴。這兩個(gè)應(yīng)用程序都有龐大而活躍的用戶群體,支持它們的發(fā)展,所以它們不太可能消失。最后,它們的數(shù)據(jù)是可移植的。 Zotero 可以將其所有數(shù)據(jù)導(dǎo)出為純文本文件,而Obsidian的數(shù)據(jù)基本上是一個(gè)用Markdown 編寫的文本文件的文件夾(在應(yīng)用中稱為 "庫"),Markdown 是一種簡(jiǎn)單的標(biāo)記語言,可以在純文本文件中創(chuàng)建格式化的文本。Obsidian 的功能,如局部圖譜(筆記之間的連接圖)和 Dataview(一個(gè)插件,它將我的筆記中的文本結(jié)構(gòu)化,所以它們可以像數(shù)據(jù)庫一樣被查詢)幫助分析我收集的信息。
我用 Zotero 導(dǎo)入源元數(shù)據(jù)和批注PDF,用 Obsidian 來處理筆記。在 Obsidian 用戶中,一個(gè)流行的方法是為每個(gè)來源創(chuàng)建一個(gè)包含所有批注的 "文獻(xiàn)筆記"。但是,正如上面的圖表(基于歷史學(xué)家Zachary Schrag https://zacharyschrag.com/ 的研究過程幻燈片)所示,同一來源的不同批注實(shí)際上可能屬于你的草稿中的不同位置。
為了做到這一點(diǎn),我把批注分成幾份研究筆記,以后再分門別類地進(jìn)行寫作。我把它們放在我的 Obsidian 庫的最上面的文件夾里,"01 筆記",并把它們標(biāo)記出來以便進(jìn)一步分析。我的研究筆記看起來是這樣的(在新窗口中打開以獲得更好的視野)。
研究筆記示例.png
這個(gè)筆記包括一個(gè)總結(jié)該筆記的標(biāo)題(它同時(shí)也是該筆記的文件名)、來源信息、文字、標(biāo)簽、我用自己添加的數(shù)據(jù)設(shè)置的 Dataview 字段,包括我的評(píng)論,以及與其他筆記的鏈接(左上角的圖表中反映的藍(lán)色文字可點(diǎn)擊)。筆記之間的鏈接是 Obsidian 的一個(gè)基本功能。它們是通過將筆記的標(biāo)題放在雙方括號(hào)里來創(chuàng)建的。[[note title here]]。Obsidian 的 "實(shí)時(shí)預(yù)覽"功能隱藏了這些格式化代碼,以方便閱讀。
在左邊你可以看到我的文件夾結(jié)構(gòu),這是 Obsidian 社區(qū)推薦的:我的研究有七個(gè)文件夾,還有一個(gè)"元"文件夾。每個(gè)文件夾的編號(hào)以 "0"開頭,以確保在你在根目錄下有超過九個(gè)研究文件夾正確的排序。在沒有編號(hào)的"元"文件夾中,我保存所有的補(bǔ)充文件,包括用于導(dǎo)入和處理 Zotero 批注的模板。(把不同種類的模板放在不同的子文件夾里是很重要的,這樣才能在Obsidian偏好中正確指定這些文件夾)。
下面我將解釋你需要做什么來達(dá)到這一點(diǎn)。
你需要安裝的東西
注意:Obsidian 插件可以很容易地從 Obsidian 內(nèi)部安裝(見下面的說明)。這里我提供了 Github 倉庫的鏈接,你可以在那里找到更多關(guān)于它們的信息。
?Zotero 6 和 Zotero 瀏覽器連接器 https://www.zotero.org/download/
?Better Bibtex for? Zotero? -? Zotero 插件 https://retorque.re/zotero-Better-bibtex/
Obsidian https://obsidian.md/
?Zotero Integration(之前叫 Zotero Desktop Connector)--Obsidian插件。https://github.com/mgmeyers/obsidian-zotero-integration 如果你的Obsidian安裝程序版本在v0.13.24之前,你需要從 obsidian.md網(wǎng)站重新安裝(而不是從應(yīng)用程序中更新)。
?Templater - Obsidian插件
?Dataview - Obsidian插件
?Zotero 批注
我在這里跳過 Zotero 及其插件的安裝,以及將資料導(dǎo)入 Zotero 的基礎(chǔ)知識(shí),因?yàn)檫@些說明在網(wǎng)上廣泛存在(例如,見這里或這里的相關(guān)部分),許多大學(xué)提供 Zotero 教程。我直接轉(zhuǎn)到 Zotero? 6的新功能(從2022年開始):PDF批注。
?Zotero 的內(nèi)置PDF閱讀器 https://www.zotero.org/support/pdf_reader,在 Zotero? 6中的新功能,以一種將批注與PDF分開的方式添加批注。這種設(shè)置要求你將你的PDF存儲(chǔ)在 Zotero 文件系統(tǒng)中,而不是作為鏈接文件駐留在你的硬盤上的其他地方。我更喜歡這種設(shè)置,因?yàn)樗试S我將我的文件和批注與iOS? Zotero 應(yīng)用程序進(jìn)行同步。我可以與我的學(xué)生分享干凈的PDF,或者如果需要的話,我可以導(dǎo)出帶有批注的PDF。如果你喜歡使用鏈接的PDF文件,或?qū)⑴⑶度氲絇DF中,并在外部PDF編輯器中工作,你將N
通過www.DeepL.com/Translator(免費(fèi)版)翻譯
From Zotero Annotations to Obsidian Research Notes
Elena Razlogova
History Department, Concordia University, Montreal
elena.razlogova[at]concordia.ca
zach drawing.png
Welcome to Doing History with Zotero and Obsidian! Learn more about the project, or read about the setup here in detail. You can also download a starter Obsidian history vault from Github which has all Obsidian plugins described here preinstalled.
Notetaking is an essential aspect of research and writing. Historians in particular take notes on a grand scale: they process hundreds or thousands of primary sources when writing a book. You may start with index cards and a corkboard. But once you get into a major historical project you may be overwhelmed with sources and connections, and a corkboard will not be enough. Digital tools become crucial at that stage.
I chose Zotero and Obsidian for digital notetaking because they are free at the entry level, and their paid features are not expensive. Both apps have large and active user communities that support their development so they are not likely to disappear. Finally, their data is portable: Zotero can export all its data as plain-text files, and Obsidian data is basically a folder (called a "vault" in the app) of text files written in markdown, a simple markup language that creates formatted text in a plain-text file. Obsidian features such the local Graph (a map of connections Between notes) and Dataview (a plugin that structures the text in my notes so they can be queried like a database) help analyze the information I collect.
I use Zotero to import source metadata and annotate PDFs, and Obsidian to work with notes. A popular way to do that among Obsidian users is to create one "literature note" per source with all annotations. But, as the above chart (based on a research process slide by historian Zachary Schrag) shows, different annotations from the same source actually might belong in different places in your draft.
In order to make this work, I split annotations into several research notes that will be later sorted into groups for writing. I put them in the top folder in my Obsidian vault, "01 notes" and mark them up for further analysis. My research notes look like this (open in a new window for Better view):
research note example.png
This note includes a title that summarizes the note (it doubles as the file name for the note), source information, text from the source, tags, Dataview fields I set up with data added by me, including my comments, and links to other notes (clickable text in blue reflected in the graph on the top left). Links Between notes are a basic feature of Obsidian. They are created by encasing the title of the note in double square brackets: [[note title here]]. The "live preview" feature in Obsidian hides this formatting code for easier reading.
On the left you see my folder structure, recommended by the Obsidian community: seven folders for my research, and a "meta" folder. Starting each folder number with a leading "0" ensures correct sorting in case you have more than nine research folders in the root directory down the road. In the unnumbered "meta" folder, I save all supplementary files, including templates for importing and processing Zotero annotations. (It is important to keep different kinds of templates in separate subfolders, in order to specify these folders correctly in the Obsidian preferences.)
Below I explain what you need to do to get to this point.
What You Need to Install
Note: Obsidian plugins can be easily installed from within Obsidian (see directions below). Here I provide links to Github repositories where you can find out more about them.
Zotero 6 and Zotero Browser Connector
Better Bibtex for Zotero - Zotero plugin
Obsidian
Zotero Integration (formerly Zotero Desktop Connector) - Obsidian plugin. If your Obsidian installer version is before v0.13.24 you will need to reinstall from obsidian.md website (rather than updating from within the app).
Templater - Obsidian plugin
Dataview - Obsidian plugin
Zotero Annotations
I am skipping the installation of Zotero and its plugins here, as well as the basics of importing sources into Zotero, because these instructions are available widely on the web (for example, see relevant sections here or here) and many universities offer Zotero tutorials. I move on directly to the new (as of 2022) feature in Zotero 6: PDF annotations.
Zotero's built-in PDF reader, new in Zotero 6, adds annotations in a way that keeps them separate from the PDF. This setup requires you to keep your PDFs stored within the Zotero file system rather than as linked files residing elsewhere on your hard drive. I prefer this setup because it allows me to sync my files and annotations with the iOS Zotero app. I can share clean PDFs with my students, or I can export a PDF with annotations if desired. If you prefer to use linked PDF files, or to keep annotations embedded in PDFs and work in an external PDF editor you will need a different set of plugins--check out this workflow by Alexandra Phelan.
I turn as many analog and electronic sources into OCRed PDFs as I can: articles and chapters in scholarly databases, scanned ILL materials, photographed archival sources, and converted EPUB files, DjVu files, and webpages. I read PDFs in Zotero’s built-in PDF reader, make annotations--highlights and comments. Finally, in the right column I create a note that includes all annotations. To do that, select the notes view in the right pane. Then click on the plus sign next to "Item Notes" and choose "Add Item Note from Annotations":
add item note from annotations.png
Zotero provides a default export template for annotations that works if you don't want to separate your notes by category.
You can also configure Zotero to categorize your annotations, for example, to distinguish the author's ideas from references that you want to add to Zotero.
Zotero Integration Setup
The basics of installing Obsidian are also available on the web; see, for example, my guidelines. Here I am focusing on how I import annotations with Zotero Integration (requires Obsidian installer version v0.13.24 or later).
First, install Zotero Integration in the Community Plugins section. Turn "Safe mode" off. Then click on "Browse".
community plugins.png
Search for the plugin, install, and activate it in the next window:
install zotero integration.png
Set up Zotero Integration preferences:
Install PDF utility
Select database: Zotero
Note Import location: The folder where you will save annotations
zotero integration settings.png
Set up the Import format and name it. Specify your research notes output path (mine is "01 notes" folder). Specify Bibtex citekey (created by BetterBibtex in Zotero) as the file name. Set up image output path.
integrator import output path.png
Specify the template file and path, saved as an .md (markdown) file in a separate folder in your vault (mine is "meta/zotero/research note.md").
integrator import location and bibliography style.png
My template for a research note separates authors by type so I can use Dataview to search by letter recipient and interviewer. It includes a template for data entry, including fields for for page number, for my comments, and for the dates of an event described in the note. And in the very end it includes all highlights and comments I made in Zotero. (If you cut and paste this template from Safari into an Obsidian note, make sure to delete the accents before and after "---").
---
type: "{{itemType}}"{% for type, creators in creators | groupby("creatorType") -%}{% if loop.first %}
{% endif %}{{type | replace("interviewee", "author") | replace("director", "author") | replace("presenter", "author") | replace("podcaster", "author") | replace("programmer", "author") | replace("cartographer", "author") | replace("inventor", "author") | replace("sponsor", "author")? | replace("performer", "author") | replace("artist", "author")}}: "{%- for creator in creators -%}{%- if creator.name %}{{creator.name}}{%- else %}{{creator.lastName}}, {{creator.firstName}}{%- endif %}{% if not loop.last %}; {% endif %}{% endfor %}"{% if not loop.last %}
{% endif %}{%- endfor %}{% if title %}
title: "{{title}}"{% endif %}{% if publicationTitle %}
publication: "{{publicationTitle}}"{% endif %}{% if date %}
date: {{date | format("YYYY-MM-DD")}}{% endif %}{% if archive %}
archive: "{{archive}}"{% endif %}{% if archiveLocation %}
archive-location: "{{archiveLocation}}"{% endif %}
citekey: {{citekey}}
---
{{bibliography}}
[online]({{uri}}) [local]({{desktopURI}}) {%- for attachment in attachments | filterby("path", "endswith", ".pdf") %} [pdf](file://{{attachment.path | replace(" ", "%20")}})
{% if loop.last %}?
{% endif %}{%- endfor -%}
?
{% if tags.length > 0 -%}{% for t in tags -%}
#{{t.tag | lower | replace(" ", "-")}}{% if not loop.last %}
{% endif %}{% endfor %}
{%- endif %}
### Index
start-date::
end-date::
page-no::
### Connections
comment::?
### Note
{% if markdownNotes %}
{{markdownNotes}}{% endif %}
The template above imports all tags attached to the Zotero item, separated by line breaks. Zotero allows for spaces in tags, but Obsidian does not, so the template replaces spaces Between words with dashes.
You may also want to import Zotero tags as nested tags. (Zotero does not allow for nested tags but Obsidian does.) I do that in order to manage them Better and to categorize notes by project and type or source.
Importing Annotations
Once you set up this system, import is easy. I set up a shortcut (Cmd-R) to call up the template, but you can also use the command palette. The command palette icon appears by default in the left-hand bar. To turn it off and on, go to Core Plugins in Settings. To call it up with a shortcut, type Cmd-P on Mac (Ctrl-P on PC).
open command palette.png
Choose "Create research note."
select zotero integration from palette.png
Then type keywords to find the source:
zotero selector.png
And Zotero Integration will add the note that already has tags (in my case, for type of source and project). It will also automatically place the source date (publication date in this case) into the "start-date" field. Change it manually if the date of the event the note describes is different from the source date. Always having the start-date field defined will help proper sorting of notes down the road. (I explain below how to search and sort your research notes.)
You will need to create a descriptive title instead of the default title based on the BibTex citekey.
imported note.png
Everything below the "Note" heading is your note made from annotations. If I did have any other notes attached to this source in Zotero they would import as well. To keep things organized, I don't keep notes of any kind in Zotero. After I import annotations, I delete "note from annotations." This way my notes are only in one place.
If you are likely to add more annotations to the PDF after the initial export, you may want to configure Zotero to categorize your annotations. That way, you can set Zotero up to export only your new annotations when you repeat the process.
The imported data I get falls into four categories:
Zotero Item metadata without annotations: If I am working with an analog source (an archival source I am not allowed to photograph, for example) and need to enter notes by hand, I just make sure there are no notes attached to the Zotero item. Then the import includes only source metadata and a template for entering the note.
Annotations relate to the same point or topic: If I have a short source that only requires one research note, after import I only have to rename the note in a way that describes its content. One note is all I need.
Annotations relate to several points or topics: If the annotations will have to be put into different parts of my draft (see Zachary Schrag's chart above), I will need several research notes. I process the data further.
Annotations are citations or bibliography entries: anything in footnotes or bibliography that belongs in my Zotero database. I need to process them as well: add them to Zotero.
Processing Imported Annotations
The Templater plugin helps to extract any selected text (one annotation or several consecutive annotations) into a new research note with one keyboard shortcut. First, install Templater from the Community plugins section in the Settings. Then, create two folders for templates and add them to Templater preferences. One folder is for Templater files:
set template folder location templater.png
The other folder is for javascript code that will be embedded into the templates:
set js folder location templater.png
In the "meta/templater" folder, place "extract research note from selection.md" file with this text:
<%*
const fileName = await tp.system.prompt("New Note Title");
tp.file.create_new(tp.user.header(tp)+tp.file.selection(), fileName, false);
await tp.file.cursor_append("[["+fileName+"]]");
%>
In the "meta/javascript" folder, place "header.js" file with this text:
function header(tp) {
? ? content=tp.file.content;
? ? selection=tp.file.selection();
? ? getheader=content.substring(0, content.indexOf("### Note")+10);
? ? pageno=selection.substring(selection.indexOf("?page=")+6, selection.indexOf("&annotation"));
? ? headerwithpageno=getheader.replace("page-no::", "page-no:: "+pageno);
? ? ?return headerwithpageno;
}
module.exports = header
(Obsidian can't open .js files and does not display them by default. If you want to see them in Obsidian, turn on "Detect all file extensions" in Settings -> Files and Links.)
Now you need to set up keyboard shortcuts in Settings. First, add the new .md file to Templater preferences:
set template hotkeys.png
Then choose the keyboard shortcut in the Hotkeys section:
hotkeys settings.png
You can choose any available key combination. I chose Cmd-Z as a hotkey.
Now, you can select any text in your note imported from Zotero and press the Cmd-Z hotkey. You will see the prompt where you can type the title for your new note. The new research note will have research metadata, tags, and the note template, the text you selected, and the page number for the annotation in the "page-no" field. You will also see the link to the new note in the original imported note, for easy navigation.
extract research note.gif
You can also use Templater to move one or several references you imported into a separate "task" note, for adding to Zotero later.
Research Note Details
My template puts source metadata on the top into the "YAML" space, denoted by three dashes on top and bottom. This data can go anywhere in a note but I like to hide it because I only need it to create Dataview searches and to connect from Zotero back to Obsidian. YAML allows it to be hidden, either with an arrow in the "editing" view, or completely in the "reading" view. I prefer to see the formatted bibliographic entry instead.
hiding yaml space.gif
I add a descriptive title to the note and my own metadata: tags, page number, events, people, or other entities (films in my case), links to other related notes, my own comments, and, if necessary, the dates of the main event the note describes. The text ending with a double column :: is a field name (in YAML you only need one :); everything to the right of :: is field data. I show below how to aggregate these fields into a table. The local graph displays the links I create:
adding links and graph.png
Each imported annotation comes with the link back to the annotation in the PDF:
obsidian to zotero.gif
Even if you entered your notes manually and don't have a pdf attached, you'll still be able to get to the Zotero item from the "local" link after your bibliographic reference:
from obsidian to zotero item.gif
You can also link from a Zotero item back to related notes in Obsidian.
Search Research Notes with Dataview
Structuring my notes allows me to keep track of my research. The regular Obsidian search (use the magnifying glass on the top left) works well for other notes, but you need to be able to search your research notes by source fields and by event dates.
First, install the Dataview plugin via Community Plugins in Settings. In Dataview preferences, turn on "Enable Javascript Queries":
dataview enable javascript.png
Then change date format for proper sorting:
dataview set date format.png
Create a separate note outside of your notes folder (in my case, "meta/dataview/Search Research Notes.md"). Add search fields and two fields for sorting. (If you paste the list from here, include the text only and omit the accent characters before and after.)
author::?
recipient::?
title::?
publication::?
date::?
archive::?
archive-location::?
comment::?
start-date::?
end-date::?
tag::?
sortby:: start-date
sortorder:: desc
Then paste the code for the second table:
```dataviewjs
const current = dv.current();
const cdate = new Date(dv.current().date).getTime();
const cstartdate = new Date(dv.current()["start-date"]).getTime();
const cenddate = new Date(dv.current()["end-date"]).getTime();
const searchterm = dv.current().tag === null ? '"01 notes"' : '"01 notes" and '+dv.current().tag;?
if (current.author || current.title || current.recipient || current.publication || current.date || current.archive || current["archive-location"] || current.comment || current["start-date"] || current["end-date"] || current.tag) {
? ? function passes(page) {
? ? ? ? return (!current.author || (page.author && page.author.includes(current.author)))
? ? ? ? ? ? && (!current.recipient || (page.recipient && page.recipient.includes(current.recipient)))
? ? ? ? ? ? && (!current.title || (page.title && page.title.includes(current.title)))
? ? ? ? ? ? && (!current.publication || (page.publication && page.publication.includes(current.publication)))
? ? ? ? && (!current.date || (page.date && new Date(page.date).getTime()===cdate))
? ? ? ? ? ? && (!current.archive || (page.archive && page.archive.includes(current.archive)))
? ? ? ? ? ? && (!current["archive-location"] || (page["archive-location"] && page["archive-location"].includes(current["archive-location"])))
? ? ? ? ? ? && (!current.comment || (page.comment && page.comment.includes(current.comment)))
? ? ? ? ? ? && (!current["start-date"] || (page["start-date"] && new Date(page["start-date"]).getTime()===cstartdate))
? ? ? ? ? ? && (!current["end-date"] || (page["end-date"] && new Date(page["end-date"]).getTime()===cenddate))
? ? ? ? ? ? ;
? ? }
? ? dv.table(
? ? ? ? ["Note", "Start Date", "End Date", "Author", "Recipient", "Title", "Publication", "Date", "Pages", "Archive", "Loc. in Archive", "Comment"],
? ? ? ? dv.pages(searchterm)
? ? ? ? ? ? .where(passes)
? ? ? ? ? ? .sort(p => p[current.sortby], current.sortorder)
? ? ? ? ? ? .map(p => [
? ? ? ? ? ? ? ? p.file.link,
? ? ? ? ? ? ? ? p["start-date"],
? ? ? ? ? ? ? ? p["end-date"],
? ? ? ? ? ? ? ? p.author,
? ? ? ? ? ? ? ? p.recipient,
? ? ? ? ? ? ? ? p.title,
? ? ? ? ? ? ? ? p.publication,
? ? ? ? ? ? ? ? p.date,
? ? ? ? ? ? ? ? p["page-no"],
? ? ? ? ? ? ? ? p.archive,
? ? ? ? ? ? ? ? p["archive-location"],
? ? ? ? ? ? ? ? p.comment
? ? ? ? ? ? ])
? ? );
} else {
? ? dv.paragraph("? ?Enter search terms into one or more fields to find research notes.");
}
```
Now you can search your research notes from this page, and sort the search results. Enter search terms into one or more fields to find research notes. For text fields, this is a case-sensitive phrase search. Enter dates as YYYY-MM-DD. Enter tag as #tag. Enter exact field title and asc/desc to change sort order. The default sort in my case is by start-date, descending, but you can search by any field included in the table.
search research notes.gif
From Source to Research Note at a Glance
Here is my research process in one chart:
zotero-obsidian workflow.png
Enjoy!
zotero-obsidian workflow.png