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 Request] Append to highlight note instead of overwriting. #91

Closed
tjex opened this issue Mar 24, 2023 · 9 comments · Fixed by #107
Closed

[Feature Request] Append to highlight note instead of overwriting. #91

tjex opened this issue Mar 24, 2023 · 9 comments · Fixed by #107
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@tjex
Copy link

tjex commented Mar 24, 2023

Painfully realised that currently when importing highlights, the entire highlights page is generated fresh.
This means that any caret references, edits to highlight notes are broken / overwritten on each import.

This limits the usefulness of the plugin quite severely as the highlights page can only then ever be used as a visual reference to read and remind ones self (or copy and paste 😵), and therefore not truly integrated into the Obsidian / Zettelkasten note making workflow.

I think the simplest solution around this would be to simply append new highlights / notes to the highlights file instead of overwriting the whole file completely with a fresh import. From memory the Kindle highlights plugin works this way.

Is it realistic to look into something like this? Would be immensely appreciated.
I want to help, but my programming chops are probably not going to do much.

I'd be happy to update and extend the documentation if needs be though.

@OGKevin
Copy link
Owner

OGKevin commented Mar 24, 2023

You're referencing https://github.com/hadynz/obsidian-kindle-plugin?

I would need to have a look on how they solved it and see.
But most likely I would need to keep a state somewhere of what has been exported and what not.

I'll have to do some brainstorming and come up with something.

@OGKevin OGKevin self-assigned this Mar 24, 2023
@OGKevin OGKevin added the enhancement New feature or request label Mar 24, 2023
@OGKevin OGKevin added this to the 1.4.0 milestone Mar 24, 2023
@tjex
Copy link
Author

tjex commented Mar 24, 2023

yep, that one.
Would be amazing man! 🙏
I'll also try have a look.

@tjex
Copy link
Author

tjex commented Mar 26, 2023

Considering the chapter names are returned from the book (ie values that are not user defined), could they be used as references for an incoming import?
eg:

  1. on import, reference the last highlight from the last chapter heading
  2. check these against the incoming import (maybe the user deleted those highlights)
  3. append the incoming highlight/note pairings that come after the latest highlight/note pairings to the file

not sure how to handle the else branch then in step 2. But will keep thinking.

@OGKevin OGKevin modified the milestones: 1.4.0, 1.6.0 Mar 26, 2023
@rsletta
Copy link

rsletta commented Apr 6, 2023

Hi,
I found your plugin when doing my "let's see if there is something out there, before I start developing my own" check. I would like to contribute to your plugin if you allow it, rather than creating something similar myself. I came up with a naive implementation tonight that keeps edits including caret references, and have pushed my changes to my fork at https://github.com/rsletta/obsidian-kobo-highlights-import.

@OGKevin
Copy link
Owner

OGKevin commented Apr 6, 2023

@rsletta yes please open a pull request! Contributions are always welcome.

I did not have a chance yet to have a good look at this, so your start will certainly help.

@OGKevin
Copy link
Owner

OGKevin commented Jan 11, 2024

@tjex are you available to test and see if it fulfils your use case?
you can download the plugin from https://github.com/OGKevin/obsidian-kobo-highlights-import/releases/tag/1.6.0-beta.0 and replace .obsidian/plugins/obsidian-kobo-highlights-importer-plugin/main.js then restart the app.

@tjex
Copy link
Author

tjex commented Jan 13, 2024

hey. great that this got done! makes the plugin so much more valuable 🙏.

I tested:

  1. Making a new highlight and note, that sit in between older and newer highlight+notes: works great (creates a new highlight and note in the markdown doc in the correct position.
  2. edit a note of a highlight: updates the note in the markdown doc
  3. deleting an annotation: the annotation does not get deleted from the markdown doc
  4. changing the range of the highlighted text: the quote (highlighted text from book) does not update in the markdown doc

Features 1 and 2 are definitely the most useful. 3 and 4 would be nice to haves. I'm not sure how much more effort it would take to implement them.

For feature 3: if I manually delete the annotation from the markdown doc (it is also deleted from the book itself), and I resync, the annotation is inserted back in.

So there is a pretty big functional issue there for deleting annotations. As it stands now, once an annotation is added, it will never be possible to remove the annotation from the markdown file. I also tried to delete the entire markdown file and sync again; the annotation is added back, despite being deleted from the book itself

Also, just on a readability / UX standpoint, the --> you can write text here blocks <-- should be replaced with something cleaner, like Local note: (this text won't be deleted on resync. And perhaps only in one spot after each highlight?

Perhaps this was already part of the plan, but just in case, it's worth pointing out for clarity!

So this does fulfil the use case, but

OGKevin added a commit that referenced this issue Jan 14, 2024
This ensures that when in non edit mode, the type marker is not visible.

#91
@OGKevin
Copy link
Owner

OGKevin commented Jan 14, 2024

Also, just on a readability / UX standpoint, the --> you can write text here blocks <-- should be replaced with something cleaner, like Local note: (this text won't be deleted on resync. And perhaps only in one spot after each highlight?

It looks like I forgot to push a change 🤦🏾
It’s supposed to be %% instead of —>, if not it will show in read mode, as in, %% is a comment marker.
Like shown here: #107 (comment)

With the way it looks in the screenshot, do you still think the text needs to change due to UX?


Regarding deletion, if I understand the code correctly, the current implementation would remove everything within that ID marker if it goes missing from the database. What you’re describing, sounds like when you delete it via the e-reader, the e-reader might not actually delete the entry from the DB? I would need to play around with it and reproduce.

Do you mind creating a new issue so we can look into this?


I need to investigate your 4th point.
Based on the investigation that @rsletta did #107 (comment)
And this: https://github.com/rsletta/obsidian-kobo-highlights-import/blob/6bc945f26436eaa74f677b585fca44b5e697f099/src/database/Highlight.test.ts#L488-L555

Updating the highlight should work if the ID’s are the same. I’ll see if I can reproduce your case with an actual end to end test case.

I’ll create a followup issue for this one 👌🏾

OGKevin added a commit that referenced this issue Jan 14, 2024
This ensures that when in non edit mode, the type marker is not visible.

#91
@tjex
Copy link
Author

tjex commented Jan 17, 2024

With the way it looks in the screenshot, do you still think the text needs to change due to UX?

I think wrapping in %% ... %% as you've done is good. Then at least in reader view, it's all neat.

Will make a new issue. Thanks so much :)

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
3 participants