├── Literature Source Notes.md ├── Zotero Notes Import Template.md └── README.md /Literature Source Notes.md: -------------------------------------------------------------------------------- 1 | 2 | > [!question] Research Questions 3 | > Todo 4 | 5 | > [!cite] Key Findings in Quotes 6 | > Todo 7 | 8 | >[!Example] Key Concepts 9 | >- Todo 10 | 11 | > [!tldr] Critical Summary 12 | > Todo 13 | 14 | Additional notes 15 | 16 | -------------------------------------------------------------------------------- /Zotero Notes Import Template.md: -------------------------------------------------------------------------------- 1 | --- 2 | aliases: 3 | - {% if title %}{{title | replace(':', '') | replace('[', '') | replace(']', '')}}{% elseif caseName%}{{caseName | replace(':', '') | replace('[', '') | replace(']', '')}}{% elseif subject%}{{subject | replace(':', '') | replace('[', '') | replace(']', '')}}{% endif %} 4 | - {% if bibliography %}{{bibliography | replace(':', '') | replace('[', '') | replace(']', '')| replace('_', '')}}{% endif %} 5 | tags: 6 | - zotero 7 | {%- if itemType == "email" %} 8 | - emails 9 | {%- endif %} 10 | {%- if itemType == "instantMessage" %} 11 | - instant_messages 12 | {%- endif %} 13 | {%- if itemType == "audioRecording" %} 14 | - audio 15 | {%- endif %} 16 | {%- if tags.length > 0 %} 17 | {%- for tag in tags %} 18 | - {{tag.tag}} 19 | {%- endfor %} 20 | {%- endif %} 21 | {%- if itemType == "email" %} 22 | {{extra}} 23 | {%- endif %} 24 | {%- if itemType == "instantMessage" %} 25 | {{extra}} 26 | {%- endif %} 27 | {%- if itemType == "audioRecording" %} 28 | {{extra}} 29 | {%- endif %} 30 | citekey: {{citationKey}} 31 | type: {{itemType}} 32 | {%- if itemType == "interview" %} 33 | {%- if creators.length > 0 %} 34 | interviewee: 35 | {%- for creator in creators %} 36 | {%- if creator.creatorType == "interviewee" %} 37 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 38 | {%- endif %} 39 | {%- endfor %} 40 | interviewer: 41 | {%- for creator in creators %} 42 | {%- if creator.creatorType == "interviewer" %} 43 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 44 | {%- endif %} 45 | {%- endfor %} 46 | {%- endif %} 47 | {%- else %} 48 | {%- if itemType == "instantMessage" %} 49 | participants: 50 | {%- if creators.length > 0 %} 51 | {%- for creator in creators %} 52 | {%- if creator.creatorType == "author" %} 53 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 54 | {%- endif %} 55 | {%- endfor %} 56 | {%- endif %} 57 | {%- else %} 58 | authors: 59 | {%- if creators.length > 0 %} 60 | {%- for creator in creators %} 61 | {%- if creator.creatorType == "author" %} 62 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 63 | {%- endif %} 64 | {%- if creator.creatorType == "editor" %} 65 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 66 | {%- endif %} 67 | {%- if creator.creatorType == "director" %} 68 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 69 | {%- endif %} 70 | {%- if creator.creatorType == "contributor" %} 71 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 72 | {%- endif %} 73 | {%- if creator.creatorType == "producer" %} 74 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 75 | {%- endif %} 76 | {%- if creator.creatorType == "castMember" %} 77 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 78 | {%- endif %} 79 | {%- if creator.creatorType == "producer" %} 80 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 81 | {%- endif %} 82 | {%- endfor %} 83 | {%- endif %} 84 | {%- if itemType == "email" %} 85 | {%- if creators.length > 0 %} 86 | contributor: 87 | {%- for creator in creators %} 88 | {%- if creator.creatorType == "contributor" %} 89 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 90 | {%- endif %} 91 | {%- endfor %} 92 | recipient: 93 | {%- for creator in creators %} 94 | {%- if creator.creatorType == "recipient" %} 95 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 96 | {%- endif %} 97 | {%- endfor %} 98 | {%- endif %} 99 | {%- endif %} 100 | {%- endif %} 101 | {%- endif %} 102 | date: {{date | format ("YYYY-MM-DD")}} 103 | {%- if itemType == "email" %} 104 | subject: {{subject | replace(':', '') | replace('[', '') | replace(']', '')}} 105 | {%- else %} 106 | title: {% if title %}{{title| replace(':', '') | replace('[', '') | replace(']', '')}}{% elseif caseName %}{{caseName| replace(':', '')}} 107 | {%- endif %} 108 | {%- endif %} 109 | {%- if publicationTitle %} 110 | publication: "[[{{publicationTitle| replace(':', '')}}]]" 111 | {%- elseif seriesTitle %} 112 | publication: "[[{{seriesTitle| replace(':', '')}}]]" 113 | {%- elseif bookTitle %} 114 | publication: "[[{{bookTitle| replace(':', '')}}]]" 115 | {%- elseif forumTitle %} 116 | publication: "[[{{forumTitle| replace(':', '')}}]]" 117 | {%- endif %} 118 | {%- if itemType == "journalArticle" %} 119 | doi: {{DOI}} 120 | {%- endif %} 121 | {%- if itemType != "email" %} 122 | url: {{url}} 123 | {%- endif %} 124 | location: {{desktopURI}} 125 | {%- if relations.length >0 %} 126 | related: 127 | {%- for relation in relations %} 128 | {%- if relation.citekey %} 129 | - "[[@{{relation.citekey}}]]" 130 | {%- endif %} 131 | {%- endfor %} 132 | {%- endif %} 133 | --- 134 | {{pdfURI}} 135 | {%- if itemType == "book" %} 136 | 137 | > [!Cite] Reference 138 | > {{bibliography}} 139 | 140 | > [!Abstract]- Abstract 141 | > {{abstractNote | replace("\n", "\n> ")}} 142 | 143 | {%- elseif itemType == "bookSection" %} 144 | 145 | > [!Cite] Reference 146 | > {{bibliography}} 147 | 148 | > [!Abstract]- Abstract 149 | > {{abstractNote | replace("\n", "\n> ")}} 150 | 151 | {%- elseif itemType == "journalArticle" %} 152 | 153 | > [!Cite] Reference 154 | > {{bibliography}} 155 | 156 | > [!Abstract]- Abstract 157 | > {{abstractNote | replace("\n", "\n> ")}} 158 | 159 | {%- elseif itemType == "case" %} 160 | 161 | > [!Cite] Reference 162 | > {{bibliography}} 163 | 164 | > [!Abstract]- Abstract 165 | > {{abstractNote | replace("\n", "\n> ")}} 166 | 167 | {%- else %} 168 | 169 | > [!Abstract]- Summary 170 | > {{abstractNote | replace("\n", "\n> ")}} 171 | 172 | {%- endif %} 173 | ## Notes 174 | 175 | {% persist "notes" %}{% endpersist %} 176 | 177 | ## AI Summary 178 | 179 | {% persist "summary" %}{% endpersist %} 180 | 181 | {% if annotations.length > 0 -%} 182 | 183 | ## Attachment Annotations 184 | {%- endif %} 185 | {% for annotation in annotations -%} 186 | {%- if annotation.comment -%} 187 | {%- if annotation.annotatedText %} 188 | **{{annotation.colorCategory}} {{annotation.type | capitalize}}** - {% if pdfLink %}[{% if annotation.page %}Page {{annotation.page}}{%- else %}Page 1{% endif %}](zotero://open-pdf/library/items/{{annotation.attachment.itemKey}}?page={{annotation.page}}&annotation={{annotation.id}}){% else %}[{% if annotation.page %}Page {{annotation.page}}{%- else %}Position{% endif %}](zotero://open-pdf/library/items/{{annotation.attachment.itemKey}}?page={{annotation.page}}&annotation={{annotation.id}}){% endif %} 189 | 190 | {%- if annotation.tags.length > 0 %} 191 | 192 | {% for antag in annotation.tags %}#{{antag.tag}} {% endfor %} 193 | 194 | {%- endif %} 195 | 196 | > {{annotation.annotatedText | escape }} 197 | 198 | **Note:** {{annotation.comment}} 199 | 200 | 201 | --- 202 | {% endif -%} 203 | {%- endif -%} 204 | 205 | {% if annotation.imageRelativePath %} 206 | 📊 **Image** - {% if pdfLink %}[{% if annotation.page %}Page {{annotation.page}}{%- else %}Page 1{% endif %}](zotero://open-pdf/library/items/{{annotation.attachment.itemKey}}?page={{annotation.page}}&annotation={{annotation.id}}){% else %}[{% if annotation.page %}Page {{annotation.page}}{%- else %}Position{% endif %}](zotero://open-pdf/library/items/{{annotation.attachment.itemKey}}?page={{annotation.page}}&annotation={{annotation.id}}){% endif %} 207 | 208 | {%- if annotation.tags.length > 0 %} 209 | 210 | {% for antag in annotation.tags %}#{{antag.tag}} {% endfor %} 211 | 212 | {%- endif %} 213 | 214 | > ![[{{annotation.imageRelativePath}}]] 215 | 216 | {%- if annotation.comment %} 217 | 218 | **Note:** {{annotation.comment}} 219 | {%- endif %} 220 | 221 | --- 222 | {% endif -%} 223 | 224 | {% if annotation.type == "note" %} 225 | **{{annotation.colorCategory}} {{annotation.type | capitalize}}** - {% if pdfLink %}[{% if annotation.page %}Page {{annotation.page}}{%- else %}Page 1{% endif %}](zotero://open-pdf/library/items/{{annotation.attachment.itemKey}}?page={{annotation.page}}&annotation={{annotation.id}}){% else %}[{% if annotation.page %}Page {{annotation.page}}{%- else %}Position{% endif %}](zotero://open-pdf/library/items/{{annotation.attachment.itemKey}}?page={{annotation.page}}&annotation={{annotation.id}}){% endif %} 226 | 227 | {%- if annotation.tags.length > 0 %} 228 | 229 | {% for antag in annotation.tags %}#{{antag.tag}} {% endfor %} 230 | 231 | {%- endif %} 232 | 233 | {%- if annotation.comment %} 234 | 235 | **Note:** {{annotation.comment}} 236 | {%- endif %} 237 | 238 | --- 239 | {% endif -%} 240 | {%- endfor -%} 241 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Obsidian Zotero Integration Templates 2 | 3 | The plugin [Obsidian Zotero Integration](https://github.com/mgmeyers/obsidian-zotero-integration) allows for seamless extraction of notes from PDF files in Zotero into Obsidian. This can be customized by setting up templates with various functions. However, not everyone is familiar with coding or template customization, which can make this process challenging. To simplify it, I’m sharing my custom script to assist colleagues in getting started easily. 4 | 5 | ## Zotero Notes Import Template 6 | 7 | **Purpose:** 8 | To import PDF highlights and notes from Zotero into Obsidian with minimal clutter. 9 | 10 | ### Requirements: 11 | - Zotero (installed and configured) 12 | - Obsidian (installed and set up) 13 | - [Obsidian Zotero Integration Plugin](https://github.com/mgmeyers/obsidian-zotero-integration) 14 | 15 | ### Features: 16 | - **Custom YAML Metadata**: Automatically updates YAML with relevant information based on the item type. 17 | - **Selective Import**: Only imports highlights that have notes attached, preventing unnecessary clutter on the page. 18 | - **Image Support**: Allows importing images from PDFs (for example, drawing a rectangle around a figure in Adobe Acrobat). 19 | 20 | ## Detailed Breakdown 21 | 22 | `Zotero Notes Import Template.md` serves as a **template** that dynamically generates both **YAML front matter** and corresponding **Markdown content** based on the metadata of Zotero items. This setup is particularly useful for creating well-structured and informative documents from bibliographic data, enabling seamless integration of references, abstracts, notes, and annotations into your documentation or static website. 23 | 24 | ### Table of Contents 25 | 26 | - [1. YAML Front Matter](#1-yaml-front-matter) 27 | - [a. Aliases](#a-aliases) 28 | - [b. Tags](#b-tags) 29 | - [c. Extra Information for Specific Item Types](#c-extra-information-for-specific-item-types) 30 | - [d. Citation Key and Type](#d-citation-key-and-type) 31 | - [e. Authors and Participants](#e-authors-and-participants) 32 | - [f. Contributors and Recipients (Emails)](#f-contributors-and-recipients-specific-to-emails) 33 | - [g. Date Formatting](#g-date-formatting) 34 | - [h. Title and Subject](#h-title-and-subject) 35 | - [i. Publication Information](#i-publication-information) 36 | - [j. DOI and URL](#j-doi-and-url) 37 | - [k. Zotero Location and File Link](#k-zotero-location-and-file-link) 38 | - [l. Related Items](#l-related-items) 39 | - [2. Markdown Content](#2-markdown-content) 40 | - [a. Conditional Sections Based on Item Type](#a-conditional-sections-based-on-item-type) 41 | - [b. Notes Section](#b-notes-section) 42 | - [c. Attachment Annotations](#c-attachment-annotations) 43 | 44 | 45 | ### 1. YAML Front Matter 46 | 47 | The YAML front matter is enclosed between `---` lines and contains metadata that can be utilized by static site generators or other processing tools to manage and display content effectively. 48 | 49 | #### a. Aliases 50 | 51 | ```yaml 52 | aliases: 53 | - {% if title %}{{title | replace(':', '') | replace('[', '') | replace(']', '')}}{% elseif caseName%}{{caseName | replace(':', '') | replace('[', '') | replace(']', '')}}{% elseif subject%}{{subject | replace(':', '') | replace('[', '') | replace(']', '')}}{% endif %} 54 | ``` 55 | 56 | - **Purpose**: Defines alternative names or identifiers (`aliases`) for the item to facilitate easier referencing and searching. 57 | - **Logic**: 58 | - **Primary Source**: Uses the `title` if available, removing colons (`:`) and square brackets (`[` and `]`). 59 | - **Fallbacks**: If `title` is unavailable, it checks for `caseName` or `subject`, applying the same cleaning process. 60 | - **Outcome**: Ensures that aliases are clean, free from problematic characters, and provide meaningful alternative identifiers. 61 | 62 | #### b. Tags 63 | 64 | ```yaml 65 | tags: 66 | - zotero 67 | {%- if itemType == "email" %} 68 | - emails 69 | {%- endif %} 70 | {%- if itemType == "instantMessage" %} 71 | - instant_messages 72 | {%- endif %} 73 | {%- if itemType == "audioRecording" %} 74 | - audio 75 | {%- endif %} 76 | {%- if tags.length > 0 %} 77 | {%- for tag in tags %} 78 | - {{tag.tag}} 79 | {%- endfor %} 80 | {%- endif %} 81 | ``` 82 | 83 | - **Purpose**: Assigns relevant tags to the item for categorization and filtering. 84 | - **Components**: 85 | - **Base Tag**: Always includes `zotero` to indicate the source. 86 | - **Conditional Tags**: Adds specific tags based on the `itemType`: 87 | - `emails` for emails. 88 | - `instant_messages` for instant messages. 89 | - `audio` for audio recordings. 90 | - **User-Defined Tags**: Iterates through any additional tags associated with the item and includes them. 91 | - **Outcome**: Provides a robust tagging system that reflects both the item's type and any user-specified categories. 92 | 93 | #### c. Extra Information for Specific Item Types 94 | 95 | ```yaml 96 | {%- if itemType == "email" %} 97 | {{extra}} 98 | {%- endif %} 99 | {%- if itemType == "instantMessage" %} 100 | {{extra}} 101 | {%- endif %} 102 | {%- if itemType == "audioRecording" %} 103 | {{extra}} 104 | {%- endif %} 105 | ``` 106 | 107 | - **Purpose**: Inserts additional metadata (`extra`) specific to certain item types like emails, instant messages, and audio recordings. 108 | - **Usage**: The `extra` field can contain supplementary information relevant to these item types, such as headers in emails or context in messages. 109 | - **Outcome**: Enhances the metadata with type-specific details, ensuring comprehensive information capture. 110 | 111 | #### d. Citation Key and Type 112 | 113 | ```yaml 114 | citekey: {{citationKey}} 115 | type: {{itemType}} 116 | ``` 117 | 118 | - **Purpose**: 119 | - **citekey**: Serves as a unique identifier for the citation, facilitating easy referencing in bibliographies or cross-references. 120 | - **type**: Specifies the Zotero item type (e.g., `email`, `journalArticle`, `audioRecording`), which can influence how the item is processed and displayed. 121 | - **Outcome**: Provides essential identification and categorization for each item. 122 | 123 | #### e. Authors and Participants 124 | 125 | ##### For Instant Messages 126 | 127 | ```yaml 128 | {%- if itemType == "instantMessage" %} 129 | participants: 130 | {%- if creators.length > 0 %} 131 | {%- for creator in creators %} 132 | {%- if creator.creatorType == "author" %} 133 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 134 | {%- endif %} 135 | {%- endfor %} 136 | {%- endif %} 137 | ``` 138 | 139 | - **Purpose**: Lists all participants involved in an instant message. 140 | - **Logic**: 141 | - Iterates through `creators` and includes those with `creatorType` as `author`. 142 | - Formats each participant's name within double square brackets (`[[ ]]`) for internal linking. 143 | - **Outcome**: Provides a clear and linked list of participants for instant messages. 144 | 145 | ##### For Other Item Types 146 | 147 | ```yaml 148 | {%- else %} 149 | authors: 150 | {%- if creators.length > 0 %} 151 | {%- for creator in creators %} 152 | {%- if creator.creatorType == "author" %} 153 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 154 | {%- endif %} 155 | {%- if creator.creatorType == "editor" %} 156 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 157 | {%- endif %} 158 | {%- if creator.creatorType == "director" %} 159 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 160 | {%- endif %} 161 | {%- if creator.creatorType == "castMember" %} 162 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 163 | {%- endif %} 164 | {%- if creator.creatorType == "producer" %} 165 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 166 | {%- endif %} 167 | {%- endfor %} 168 | {%- endif %} 169 | ``` 170 | 171 | - **Purpose**: Compiles a comprehensive list of contributors based on their roles. 172 | - **Roles Handled**: 173 | - `author` 174 | - `editor` 175 | - `director` 176 | - `castMember` 177 | - `producer` 178 | - **Logic**: 179 | - Iterates through `creators` and includes those matching the specified `creatorType`. 180 | - Formats each name within double square brackets for linking. 181 | - **Outcome**: Generates a detailed and linked list of contributors for various item types. 182 | 183 | #### f. Contributors and Recipients Specific to Emails 184 | 185 | ```yaml 186 | {%- if itemType == "email" %} 187 | {%- if creators.length > 0 %} 188 | contributor: 189 | {%- for creator in creators %} 190 | {%- if creator.creatorType == "contributor" %} 191 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 192 | {%- endif %} 193 | {%- endfor %} 194 | recipient: 195 | {%- for creator in creators %} 196 | {%- if creator.creatorType == "recipient" %} 197 | - {% if creator.name %}"[[{{creator.name}}]]"{% else %}"[[{{creator.firstName}} {{creator.lastName}}]]"{% endif %} 198 | {%- endif %} 199 | {%- endfor %} 200 | {%- endif %} 201 | {%- endif %} 202 | ``` 203 | 204 | - **Purpose**: Specifically handles contributors and recipients in email items. 205 | - **Components**: 206 | - **contributor**: Lists all contributors (`creatorType` == `contributor`) associated with the email. 207 | - **recipient**: Lists all recipients (`creatorType` == `recipient`) of the email. 208 | - **Logic**: 209 | - Iterates through `creators` and segregates them based on `creatorType`. 210 | - Formats names within double square brackets for linking. 211 | - **Outcome**: Provides a clear distinction between contributors and recipients in email items, enhancing the metadata's clarity and utility. 212 | 213 | #### g. Date Formatting 214 | 215 | ```yaml 216 | date: {{date | format ("YYYY-MM-DD")}} 217 | ``` 218 | 219 | - **Purpose**: Standardizes the `date` field to the `YYYY-MM-DD` format. 220 | - **Usage**: Ensures consistency across all items, facilitating sorting and filtering based on dates. 221 | - **Outcome**: Maintains uniform date formatting for better data management and readability. 222 | 223 | #### h. Title and Subject 224 | 225 | ```yaml 226 | {%- if itemType == "email" %} 227 | subject: {{subject | replace(':', '') | replace('[', '') | replace(']', '')}} 228 | {%- else %} 229 | title: {% if title %}{{title| replace(':', '') | replace('[', '') | replace(']', '')}}{% elseif caseName %}{{caseName| replace(':', '')}} 230 | {%- endif %} 231 | {%- endif %} 232 | ``` 233 | 234 | - **Purpose**: 235 | - **Emails**: Uses the `subject` field. 236 | - **Other Items**: Uses the `title` or `caseName`. 237 | - **Logic**: 238 | - Removes colons and square brackets from `subject`, `title`, or `caseName` to ensure clean metadata. 239 | - **Outcome**: Provides a clear and clean title or subject for each item, enhancing readability and searchability. 240 | 241 | #### i. Publication Information 242 | 243 | ```yaml 244 | {%- if publicationTitle %} 245 | publication: "[[{{publicationTitle| replace(':', '')}}]]" 246 | {%- elseif seriesTitle %} 247 | publication: "[[{{seriesTitle| replace(':', '')}}]]" 248 | {%- elseif bookTitle %} 249 | publication: "[[{{bookTitle| replace(':', '')}}]]" 250 | {%- elseif forumTitle %} 251 | publication: "[[{{forumTitle| replace(':', '')}}]]" 252 | {%- endif %} 253 | ``` 254 | 255 | - **Purpose**: Specifies the publication source of the item. 256 | - **Logic**: 257 | - Checks for various publication-related fields in a prioritized order: 258 | 1. `publicationTitle` 259 | 2. `seriesTitle` 260 | 3. `bookTitle` 261 | 4. `forumTitle` 262 | - Removes colons from the selected title. 263 | - Encloses the publication title within double square brackets for internal linking. 264 | - **Outcome**: Accurately references the publication source, facilitating easy navigation and cross-referencing. 265 | 266 | #### j. DOI and URL 267 | 268 | ```yaml 269 | {%- if itemType == "journalArticle" %} 270 | doi: {{DOI}} 271 | {%- endif %} 272 | {%- if itemType != "email" %} 273 | url: {{url}} 274 | {%- endif %} 275 | ``` 276 | 277 | - **Purpose**: 278 | - **DOI**: Included only for journal articles to provide a persistent link to the digital object. 279 | - **URL**: Included for all item types except emails to link to the resource. 280 | - **Outcome**: Enhances accessibility by providing direct links to the item's digital location. 281 | 282 | #### k. Zotero Location and File Link 283 | 284 | ```yaml 285 | zotero_location: {{desktopURI}} 286 | file_link: {% if attachments[0] %}file:///{{attachments[0].path | replace(' ', '%20')}}{% endif %} 287 | ``` 288 | 289 | - **Purpose**: 290 | - **zotero_location**: Provides the Zotero desktop URI for direct access to the item within Zotero. 291 | - **file_link**: Generates a file URL for the first attachment, replacing spaces with `%20` to ensure URL validity. 292 | - **Outcome**: Facilitates quick access to the item's location in Zotero and its attachments, enhancing workflow efficiency. 293 | 294 | #### l. Related Items 295 | 296 | ```yaml 297 | {%- if relations.length >0 %} 298 | related: 299 | {%- for relation in relations %} 300 | {%- if relation.citekey %} 301 | - "[[@{{relation.citekey}}]]" 302 | {%- endif %} 303 | {%- endfor %} 304 | {%- endif %} 305 | ``` 306 | 307 | - **Purpose**: Links related Zotero items by their `citekey`. 308 | - **Logic**: 309 | - Iterates through `relations` and includes those with a valid `citekey`. 310 | - Formats each related item's `citekey` within double square brackets and prefixes with `@` for referencing. 311 | - **Outcome**: Establishes connections between related items, enhancing the network of references and facilitating comprehensive data navigation. 312 | 313 | ### 2. Markdown Content 314 | 315 | Following the YAML front matter, the template includes **Markdown content** that conditionally displays references, abstracts, summaries, notes, and attachment annotations based on the item's type and associated data. 316 | 317 | #### a. Conditional Sections Based on Item Type 318 | 319 | ```markdown 320 | {%- if itemType == "book" %} 321 | 322 | > [!Cite] Reference 323 | > {{bibliography}} 324 | 325 | > [!Abstract]- Abstract 326 | > {{abstractNote | replace("\n", "\n> ")}} 327 | 328 | {%- elseif itemType == "bookSection" %} 329 | 330 | > [!Cite] Reference 331 | > {{bibliography}} 332 | 333 | > [!Abstract]- Abstract 334 | > {{abstractNote | replace("\n", "\n> ")}} 335 | 336 | {%- elseif itemType == "journalArticle" %} 337 | 338 | > [!Cite] Reference 339 | > {{bibliography}} 340 | 341 | > [!Abstract]- Abstract 342 | > {{abstractNote | replace("\n", "\n> ")}} 343 | 344 | {%- elseif itemType == "case" %} 345 | 346 | > [!Cite] Reference 347 | > {{bibliography}} 348 | 349 | > [!Abstract]- Abstract 350 | > {{abstractNote | replace("\n", "\n> ")}} 351 | 352 | {%- else %} 353 | 354 | > [!Abstract]- Summary 355 | > {{abstractNote | replace("\n", "\n> ")}} 356 | 357 | {%- endif %} 358 | ``` 359 | 360 | - **Purpose**: Displays structured reference and abstract information based on the item's type. 361 | - **Components**: 362 | - **Reference Section**: 363 | - **Header**: `[!Cite] Reference` indicates a citation block. 364 | - **Content**: `{{bibliography}}` inserts the formatted bibliography entry. 365 | - **Abstract/Summary Section**: 366 | - **Header**: `[!Abstract]- Abstract` or `[!Abstract]- Summary` depending on the item type. 367 | - **Content**: `{{abstractNote}}` displays the abstract or summary, with line breaks formatted for block quotes. 368 | - **Logic**: 369 | - For specific item types (`book`, `bookSection`, `journalArticle`, `case`), it displays both a reference and an abstract. 370 | - For all other item types, it only displays a summary. 371 | - **Outcome**: Provides clear and consistent presentation of references and abstracts, enhancing the document's informational value. 372 | 373 | #### b. Notes Section 374 | 375 | ```markdown 376 | ## Notes 377 | 378 | {% persist "notes" %}{% endpersist %} 379 | ``` 380 | 381 | - **Purpose**: Creates a section for notes associated with the item. 382 | - **Components**: 383 | - **Header**: `## Notes` denotes a second-level heading in Markdown. 384 | - **Content**: `{% persist "notes" %}{% endpersist %}` is a placeholder for persisting notes. This guarantee that the notes written between the "persistent area" will no be erased when running the import in the future. 385 | - **Outcome**: Allocates a designated area for adding and storing notes related to the Zotero item. 386 | 387 | #### c. Attachment Annotations 388 | 389 | ```markdown 390 | {% if annotations.length > 0 -%} 391 | ## Attachment Annotations 392 | {%- endif %} 393 | {% for annotation in annotations -%} 394 | {%- if annotation.comment -%} 395 | {%- if annotation.annotatedText %} 396 | **{{annotation.colorCategory}} {{annotation.type | capitalize}}** - Page [{% if annotation.page %}{{annotation.page}}{% else %}1{% endif %}](zotero://open-pdf/library/items/{{annotation.attachment.itemKey}}?page={{annotation.page}}&annotation={{annotation.id}}) 397 | 398 | {%- if annotation.tags.length > 0 %} 399 | 400 | {% for antag in annotation.tags %}#{{antag.tag}} {% endfor %} 401 | 402 | {%- endif %} 403 | 404 | > {{annotation.annotatedText | escape }} 405 | 406 | **Note:** {{annotation.comment}} 407 | 408 | 409 | --- 410 | {% endif -%} 411 | {%- endif -%} 412 | 413 | {% if annotation.imageRelativePath %} 414 | 📊 **Image** - Page [{{annotation.page}}](zotero://open-pdf/library/items/{{annotation.attachment.itemKey}}?page={{annotation.page}}&annotation={{annotation.id}}) 415 | 416 | {%- if annotation.tags.length > 0 %} 417 | 418 | {% for antag in annotation.tags %}#{{antag.tag}} {% endfor %} 419 | 420 | {%- endif %} 421 | 422 | > ![[{{annotation.imageRelativePath}}]] 423 | 424 | {%- if annotation.comment %} 425 | 426 | **Note:** {{annotation.comment}} 427 | {%- endif %} 428 | 429 | --- 430 | {% endif -%} 431 | 432 | {% if annotation.type == "note" %} 433 | **{{annotation.colorCategory}} {{annotation.type | capitalize}}** - Page [{% if annotation.page %}{{annotation.page}}{% else %}1{% endif %}](zotero://open-pdf/library/items/{{annotation.attachment.itemKey}}?page={{annotation.page}}&annotation={{annotation.id}}) 434 | 435 | {%- if annotation.tags.length > 0 %} 436 | 437 | {% for antag in annotation.tags %}#{{antag.tag}} {% endfor %} 438 | 439 | {%- endif %} 440 | 441 | {%- if annotation.comment %} 442 | 443 | **Note:** {{annotation.comment}} 444 | {%- endif %} 445 | 446 | --- 447 | {% endif -%} 448 | {%- endfor -%} 449 | ``` 450 | 451 | - **Purpose**: Displays annotations associated with attachments (e.g., PDFs) in a structured and visually distinct manner. 452 | - **Components**: 453 | - **Header**: `## Attachment Annotations` appears only if there are annotations. 454 | - **Annotation Entries**: Each annotation is processed and displayed based on its content and type. 455 | - **Logic**: 456 | - **Annotation with Comment and Annotated Text**: 457 | - **Icon**: A styled paragraph symbol (`¶`) with a background color corresponding to the annotation's category. 458 | - **Header**: Displays the annotation's category and type (capitalized). 459 | - **Page Link**: Links to the specific page and annotation within Zotero. 460 | - **Tags**: Displays any associated tags as hashtags. 461 | - **Content**: Shows the annotated text in a block quote. 462 | - **Note**: Provides additional comments. 463 | - **Annotation with Image**: 464 | - **Icon**: A chart emoji (`📊`) indicating an image. 465 | - **Header**: Similar to text annotations, with a link to the specific page and annotation. 466 | - **Tags**: Displays associated tags. 467 | - **Content**: Embeds the image using the relative path. 468 | - **Note**: Includes any comments. 469 | - **Annotation of Type "Note"**: 470 | - **Icon**: A styled square symbol (`◩`) with corresponding background color. 471 | - **Header**: Displays category and type. 472 | - **Page Link**: Links to the specific page and annotation. 473 | - **Tags**: Shows associated tags. 474 | - **Note**: Includes comments. 475 | - **Formatting**: 476 | - **Block Quotes**: Uses `>` to format annotated text and embedded images. 477 | - **Horizontal Rules**: `---` separates individual annotations for clarity. 478 | - **Emojis and Styled Icons**: Enhance visual distinction between different types of annotations. 479 | - **Outcome**: Presents annotations in an organized, visually appealing manner, making it easy to review and navigate through notes, comments, and images associated with the item's attachments. 480 | 481 | --- 482 | 483 | ### Example Output 484 | 485 | ```markdown 486 | --- 487 | aliases: Example Title 488 | tags: 489 | - zotero 490 | - emails 491 | - important 492 | citekey: ABC123 493 | type: email 494 | authors: 495 | - "[[John Doe]]" 496 | contributor: 497 | - "[[Jane Smith]]" 498 | recipient: 499 | - "[[Alice Johnson]]" 500 | date: 2024-04-15 501 | subject: Meeting Agenda 502 | publication: "[[Company Newsletter]]" 503 | url: https://example.com 504 | zotero_location: zotero://select/items/XYZ789 505 | file_link: file:///path/to/attachment.pdf 506 | related: 507 | - "[[@DEF456]]" 508 | --- 509 | 510 | > [!Cite] Reference 511 | > John Doe. *Example Title*. Company Newsletter, 2024. 512 | 513 | > [!Abstract]- Abstract 514 | > This document outlines the agenda for the upcoming meeting, including key discussion points and objectives. 515 | 516 | ## Notes 517 | 518 | Your notes will appear here. 519 | 520 | ## Attachment Annotations 521 | 522 | **Yellow Highlight Note** - Page [5](zotero://open-pdf/library/items/XYZ789?page=5&annotation=12345) 523 | 524 | #important 525 | 526 | > This section discusses the main goals for the meeting. 527 | 528 | **Note:** Ensure all participants are prepared with their reports. 529 | 530 | --- 531 | ``` 532 | 533 | #### Contributing 534 | 535 | Contributions are welcome! Please feel free to submit issues or pull requests to enhance the template's functionality or adapt it to additional use cases. 536 | 537 | --------------------------------------------------------------------------------