do-me / SemanticFinder

SemanticFinder - frontend-only live semantic search with transformers.js
https://do-me.github.io/SemanticFinder/
MIT License
210 stars 14 forks source link

Highlight conflicts in Extension #47

Closed b-mc2 closed 5 months ago

b-mc2 commented 5 months ago

There are some conflicts with the highlight css class on certain websites when using the Extension including Github that can make a page pretty unusable. I believe it's this file specifically content.css

With SemanticFinder extension normally, note the highlight class name highlight1

Result of changing the highlight to un-highlight unhighlight1

This can also be confirmed by going onto a page where the yellow highlight is applied then disabling the extension and reloading the page. It happens on a decent number of sites across the web due to highlight class name being fairly common and apparently very common with code blocks and syntax highlighters.

A fix, I think would be to just change highlight to something more uniquely named.

That being said, this is a great extension! It's really a nice tool to have and search through pages for semantic similarities and is really fast, thanks for making it available.

do-me commented 5 months ago

Thank you so much for the feedback. I'm really glad that the extension found a happy user!

That's a good point with the conflicting highlights. Apart from GitHub, could you maybe name a few example pages we could use for testing? I will look into this in more detail next week as I am traveling at the moment.

I don't remember exactly how long an update on the Chrome store takes but it should be around a week or so from the next release.

If you notice any other bugs or of you'd really need a particular feature let us know so we could ship it together in case!

b-mc2 commented 5 months ago

Of course now that I'm looking for examples, I can't find many. Mostly just stumble upon them, but for some of these that have highlight but aren't being highlighted, I used Github search: https://github.com/search?q=class%3D%22highlight%22&type=code

This site has a few blog posts in which this highlighting happens to the entire code block. https://www.pgrs.net/2024/03/21/duckdb-as-the-new-jq/ https://www.pgrs.net/2023/11/14/two-exciting-postgresql-features-to-improve-null-handling/ highlight4

Here's an example of where SemanticFinder tries to highlight a section but is mostly overridden. Notice the small yellow corners of the code block and the slightly larger yellow sides. These go away when disabling SemanticFinder extension and reloading the page. https://textual.textualize.io/getting_started/#from-pypi highlight3

But here's also some examples I've found where highlight class exists but isn't being highlighted. It might have something to do with if the class is actually being used for CSS or something? I'm not sure yet.

https://scikit-learn.org/stable/install.html#install-official-release nonhighlight1

Removing theme.css from the site lets SemanticFinder highlight those sections.

https://docs.python.org/3/library/idle.html#command-line-usage nonhighlight2

If I figure anything else out, or find more examples I'll share them here. Thanks!

do-me commented 5 months ago

That's very useful, thanks for taking the time to post the examples. Will come back here as soon as the new release is ready!

do-me commented 5 months ago

Your examples were really useful for testing. I changed the highlight class name and added !important to the css so it shouldn't be overwritten by the page's css. Now it works properly for all pages you mentioned.

It might take a couple of days until the Chrome Store approves the changes. Until then you can build the extension locally and install it as explained here. Let me know if you notice anything else!

do-me commented 5 months ago

It's also live on the Chrome store. Just update the plugin and it should work!

b-mc2 commented 5 months ago

Looks good for me, took me a minute to see the changes because I had a weird issue where Brave browser wasn't updating any extensions, but reinstalling worked. Thanks! I'll close this.