Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the same file with updated annotations #51

Open
TheFermi0n opened this issue May 23, 2023 · 1 comment
Open

Update the same file with updated annotations #51

TheFermi0n opened this issue May 23, 2023 · 1 comment

Comments

@TheFermi0n
Copy link

I really appreciate your work on this plugin. It is amazing. But I wish you add a very basic feature as explained below.

Problem

If I import a book into obsidian it makes the file accordingly based on the template mentioned. And I can see you have added an option to rename the old file when importing a updated instance of the same book. It won't even import the same book with the off. Really painful.

Possible solution

I am using a plugin called Obsidian Zotero Integration. It pulls the entries in my Zotero library and then creates a file in the said location according to the defined template.

Now, the best part is that it follows something called Nunjucks templating language. I don't know the technical stuff much but it made the plugin really amazing.

What it does?

Well simply saying it just prevents part of the defined template to not be overwritten every time the user initiate the import to add the new annotations into pre-existent file. For more information please check this section of obsidian zotero plugin

I can add {% persist "id" %} nothing is changed inside this {% endpersist %}

For example I am attaching a part of my zotero import code here

{% persist "annotations" %}
{% set newAnnotations = annotations | filterby("date", "dateafter", lastImportDate) %}
{% if newAnnotations.length > 0 %}

### Imported on {{importDate | format("DD MMM, YYYY HH:mm")}}

{% for annotation in newAnnotations -%}

> [!{{annotation.colorCategory|lower}}|{{annotation.colorCategory|lower}}]+ Annotation
> {%- if annotation.annotatedText -%} {{annotation.annotatedText}} ([pg. {{annotation.page}}](zotero://open-pdf/library/items/{{annotation.attachment.itemKey}}?page={{annotation.page}}&annotation={{annotation.id}})){% endif %}
> {% if annotation.imageRelativePath %}![[{{annotation.imageRelativePath}}]]{% endif %}
> >{% if annotation.comment %} [!note]- comment
> > {{annotation.comment}}{%- endif %}

{% endfor %}

{% endif %}
{% endpersist %}

Outcome

  • Make it easier to manage annotations
  • No file clutter
@bingryan
Copy link
Owner

@okarin001 Thank you for your interest in this plugin and providing ideas for improvement, I will improve it according to your description 🫡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants