AdguardTeam / VscodeAdblockSyntax

Comprehensive extension to manage Adblock Syntax in VSCode: syntax highlighter, linter and much more. Available on the VSCode Marketplace.
https://marketplace.visualstudio.com/items?itemName=adguard.adblock
MIT License
74 stars 8 forks source link

Add support for highlighting $document,domain= uBO modifier #26

Closed ameshkov closed 5 years ago

ameshkov commented 5 years ago

Highlighting does not work for rules like this in the current version: ||parajumpersnettbutikk.com^$document,domain=~ Advarselen vises grunnet: En grovt falsk nettbutikksvindel som er svartelistet av Forbrukertilsynet.

ameshkov commented 5 years ago

@DandelionSprout I found it in your filter list, but I cannot find the formal modifier description. Could you please point me to a place where I can read about it?

DandelionSprout commented 5 years ago

The use of $domain~ [normal text comment] was a very quirky loophole I devised for uBO users, so that if a page warning was triggered for uBO users, it would show the text comment as a part of the page warning. I presumed that a lot of laymen didn't ever look up the source lists to look for comments for why a page was blocked, so I figured that I should bring the comments to them instead.

As for using $document for page blocking instead of page whitelisting, I believe it is currently a uBO- and Nano-only feature, with documentation for it at https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#document. Although it claims to not be necessary, I've found it to be necessary for subdomains that does not host blocked files on them, e.g. ||youtube.com/tv^$document.

If you meant something else than those two things, feel free to specify your question further.

ameshkov commented 5 years ago

@DandelionSprout ha, this is smart:)

ameshkov commented 5 years ago

@gorhill check this out, please. What do you think about making it legal for filters maintainers to specify the reason for strict blocking?

For instance, in AG I'd like to do the following:

  1. Save comment lines which precede the rule
  2. Print them on the "request blocked" page and in the requests log.

Example:

! This is a tricky rule that needs some explanation
! The explanation can take more than one line
||example.org^
DandelionSprout commented 5 years ago

When writing e.g. ||example.com # Comment into Nano Adblocker's My Filters (as Nano tries to list broad explanations when an entry has been miswritten, which uBO does not), it claims that in-entry comments have been deprecated, so there must've been a conscious decision taken by gorhill (or possibly Jspenguin) at some point in time.

Edit: Nevermind this GitHub comment; I had misread your question to gorhill and originally thought you asked him about in-entry comments.