mgmeyers / obsidian-zotero-integration

Insert and import citations, bibliographies, notes, and PDF annotations from Zotero into Obsidian.
GNU General Public License v3.0
1.09k stars 55 forks source link

Difficulty Extracting Specific HashTags from Annotations #347

Open linem7 opened 9 months ago

linem7 commented 9 months ago

Hello,

I'm currently working on retrieving information from the annotations field in PDF documents. My annotations include multiple tags within the selected text, such as "#tag1, #tag2", which are stored under the hashTags files. I'm trying to specifically detect and retrieve information tagged only with "#tag1" using the following syntax:

**Original**:
{% for annotation in annotations %}
  {% if "#tag1" in annotation.hashTags %}
    {{ annotation.annotatedText }}
  {% endif %}
{% endfor %}

However, I'm encountering issues where I can't use the in operation in if function and seem to isolate and retrieve information associated only with "#tag1". I'm reaching out to see if anyone might be able to offer some guidance or assistance on this matter.

Thank you in advance for your help.

Best regards.

FeralFlora commented 8 months ago

annotation.hashTags is a formatted string, not an array, that's why your approach won't work. Use annotation.tags instead.