dstein64 / highlight

A browser extension for automatically highlighting the important content on article pages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: avoid source code

hmijail opened this issue · comments

I find that pages which contain source code tend to get (parts of) it highlighted, which makes no sense. Additionally, it also seems to throws off the highlighting on the rest of the page.

So it'd be great if there was any possibility of avoiding source code when considering what to highlight; or if that's too hard / impossible, then to just disable highlighting if source code is detected.

As for how to detect source code, as a first guesstimation, I'd imagine that if there is some block of monospaced text, that's suspicious enough.

HI @hmijail. Do you have particular example pages that you can share? That would help for devising a workaround and testing that it works.

@hmijail, thanks for reporting the issue and providing the examples!

I've added a workaround that excludes text from consideration if it's in a <pre> tag and the page is not primarily comprised of such text. This handles the examples you've shared. Please let me know if you encounter any additional examples that remain problematic, or any pages that you believe this update may have introduced a new problem on.

I've submitted the updated extension to Chrome, Firefox, and Edge. It has been approved for Chrome and Firefox, and the review is still pending for Edge (it can take up to a few days, based on prior experience).