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

[Feature] Don't reset the YAML metadata when syncing #527

Closed
davidoskky opened this issue Jun 19, 2023 · 20 comments
Closed

[Feature] Don't reset the YAML metadata when syncing #527

davidoskky opened this issue Jun 19, 2023 · 20 comments
Labels
enhancement New feature or request

Comments

@davidoskky
Copy link

I export notes and keep them in sync, I do edit them externally as well. I'd like to be able to add things to the yaml frontmatter, but when the note gets synced with Zotero the yaml gets resetted to the exported one.
It would be nice if the sync process kept metadata contained in the yaml untouched.
Maybe you could introduce a sort of divider after which you can add your own metadata to the yaml and that is preserved.

@davidoskky davidoskky added the enhancement New feature or request label Jun 19, 2023
@windingwind
Copy link
Owner

We cannot save yaml data in a Zotero note, keeping them seem to be not possible.

@young-liuos
Copy link

Can I select the yaml field for synchronization? If you have the option, then you can set the zotero field such as copyright field as you want to import into yaml, synchronization will not affect the change of this field, unless the field is modified in zotero

@windingwind
Copy link
Owner

That could be a workaround.

@windingwind
Copy link
Owner

But, the note item does not have metadata. No insurance that the note item has a parent item with writable metadata.

@Xieading
Copy link

我遇到了同样的问题,每次同步的时候会自动刷新YAML,这让我无法在obsidian中使用文档属性的功能,很苦恼。
I had the same problem that YAML was automatically refreshed every time I synchronized, which made it difficult for me to use the document properties functionality in obsidian, which was very distressing.

@windingwind
Copy link
Owner

OK, so a possible workaround is to keep the YAML key-value starting with $ during syncing (but they will not affect Zotero data). Would that be acceptable?

Example:

In synced markdown:

- libraryID: 123 # generated by BN, unmutable
- $keptData: xyz # added by user but starts with `$`, not overridden during syncing
- otherData: ABC # added by user, overridden during syncing

After syncing:

- libraryID: AJHKHS # generated by BN, unmutable
- $keptData: xyz # added by user but starts with `$`, not overridden during syncing

@github-actions
Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Oct 17, 2023
@windingwind
Copy link
Owner

@davidoskky Any idea? If we have no further discussion the robot will close this issue

@davide-grheco
Copy link

I think the idea of the $ prefix is good, however I'd rather have the prefix on the keys generated automatically by zotero and not on the ones inserted by users.
In this way, Zotero knows anything prefixed with a $ can be safely deleted and everything else shall be left untouched.
If this is possible, I'd consider it the best option available as of now.

@github-actions github-actions bot removed the stale label Oct 21, 2023
@Rhydderch
Copy link

Hey all, I just discovered this plugin which sees awesome. I will probably switch to zotero 7 and start using it.
As I use Obsidian, I'm very interested in this specific issue. If this gets fixed, it would make it the perfect plugin to work together with obsidian.

For me the $sign for user-added YAML seems like a good comprise; even though I agree with @davide-grheco that it would be better for zotero YAML to be prefixed with a dollar sign, not to mess up user-added YAML in obsidian.

However, that is not possible, I still think the prefix is the best workaround @windingwind

@Rhydderch
Copy link

Hi, @windingwind, any chance you could give an update? Even if it's to say you might not be able to implement this!

fix option 1: add $ in front of frontmatter generated by zotero -> only these values can be removed/updated/insert by the plugin. Therefore other user-generated variables wont be affected.

fix option 2 (but worse UX): ignore values with $ in front or perhaps a customizable value (in this way, user can set specific YAML variables that won't be renoved/overriden)

@davidoskky
Copy link
Author

Hello there, I'm sorry I just realized I replied with the account @davide-grheco by error.
Take what I wrote above as my opinion.

@OttoHampel
Copy link

Hi, I use YAML data to track status and to display the progress in different views, it's an important part of my workflow for editing notes in obsidian (and it seems for some others too). Therefore it is important that the user generated YAML data is not overwritten. I would be happy with any solution or workaround.

@windingwind
Copy link
Owner

fix option 1: add $ in front of frontmatter generated by zotero -> only these values can be removed/updated/insert by the plugin. Therefore other user-generated variables wont be affected.

This makes sense to me. I'll try to implement it recently.

@windingwind
Copy link
Owner

@Rhydderch
Copy link

Please check the latest beta: https://github.com/windingwind/zotero-better-notes/releases/tag/1.1.4-38

Thank you! I will try it out and let you know how it goes

@Rhydderch
Copy link

It's awesome, it works! :)

@windingwind
Copy link
Owner

glad to know:)

@jakobkilian
Copy link

Hi there. Thanks for your effort for this plugin.
I also use Obsidian for note taking and sync with Zotero using Better Notes. I appreciate the new option, that Zotero doesn't overwrite externally changed frontmatter.
It would be cool, however, to have control over which items will be updated by Zotero and which not by e.g. using $ in the [ExportMDFileHeaderV2] as well with e.g.: header.$zotero_tags = noteItem.parentItem.getTags().map((_t) => _t.tag);

would that be easy to integrate?

@atyshka
Copy link

atyshka commented Jul 9, 2024

It seems there is no way then to auto-update tags in Obsidian? New Zotero tags won't get added to Obsidian unless the tags field is prefixed with $, but adding that prefix means that Obsidian doesn't recognize it as a tags field

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

No branches or pull requests

9 participants