-
Notifications
You must be signed in to change notification settings - Fork 75
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
implement highlights properly and efficently #30
Comments
You probably already know this, but wanted to leave a note on some behavior I've observed regarding highlighting. It appears that the granularity of highlighting is based on a block of text. That is, if you have one sentence out of a paragraph included in your org mode file, Promnesia will highlight the entire paragraph when the web page is visited. For example:
Will cause the full paragraph to be highlighted:
|
Yes! Thanks for a specific example though. promnesia/extension/src/sidebar.js Lines 215 to 249 in afceaa4
This specific thing might not be too hard to fix (e.g. find the exact bit to be highlighted, split the element in to spans, etc), but I've tried not to invest too much time in it so far because it's very hard to get it right (and with good performance), so ultimately I hope to collaborate/borrow code from Hypothes.is or Worldbrain Memex! |
Ah nice, thanks for the link to the implementation, that's interesting. I agree, doing this "well" and with good performance seems hard. +1 re: punting and borrowing from Hypothes.is / Worldbrain Memex 👍 Another thing I noticed is that sometimes only some of the sections would be highlighted, or only the first one (e.g. of 3 sections of copied text from a page, only the first in my notes file would be highlighted). I was able to hack around that a bit by creating a new header for each block of text I wanted highlighted, and including the link to the web page under each header before the copied text. I haven't poked at it in too much detail, it's Good Enough for now :) |
More work on it here 9d21d18 |
Hi @karlicoss . I have an issue here when I tried the example above in an org file. Despite the URL is showing correctly, the highlight is not showing despite the exact text! |
Hi @OmarAshkar can you share a snippet of org-mode and the website you clipped it from? So I could try to debug |
@karlicoss I just used this same snippet with clipped text from the home page.
I am using doom emacs and firefox on ubuntu. |
Ah indeed, thanks, same happens for me. I guess in principle, I should have the whole https://github.com/karlicoss/promnesia highlighted because I have this repository cloned and indexed, wheras it has a few gaps. |
@karlicoss Oh, the whole page is to be highlighted! I thought only the clipped part will be highlighted like hypothesis.is and memex? Either way is working anyway! |
Ah no, indeed it will ideally highlight the sentence/paragraph only. |
At the moment the algorithm is very basic and not super reliable.
Tried using diff-match-patch, but it was quite awkward. Doesn't seem to support patterns longer than 32 bits?
I think Hypothes.is is using it for highlights, but they have modified it?
The text was updated successfully, but these errors were encountered: