{"id":13596839,"url":"https://github.com/AdguardTeam/VscodeAdblockSyntax","last_synced_at":"2025-04-09T20:31:30.930Z","repository":{"id":37734274,"uuid":"115717021","full_name":"AdguardTeam/VscodeAdblockSyntax","owner":"AdguardTeam","description":"Comprehensive extension to manage Adblock Syntax in VSCode: syntax highlighter, linter and much more. Available on the VSCode Marketplace.","archived":false,"fork":false,"pushed_at":"2025-04-07T17:47:09.000Z","size":662,"stargazers_count":78,"open_issues_count":28,"forks_count":7,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-07T18:43:24.321Z","etag":null,"topics":["adblock","adblock-plus","adguard","ublock-origin","visual-studio-extension"],"latest_commit_sha":null,"homepage":"https://marketplace.visualstudio.com/items?itemName=adguard.adblock","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AdguardTeam.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-29T11:30:14.000Z","updated_at":"2025-04-07T17:47:12.000Z","dependencies_parsed_at":"2023-11-07T14:29:50.349Z","dependency_job_id":"dd7debba-b451-4a70-b561-f76fe91d09f4","html_url":"https://github.com/AdguardTeam/VscodeAdblockSyntax","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdguardTeam%2FVscodeAdblockSyntax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdguardTeam%2FVscodeAdblockSyntax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdguardTeam%2FVscodeAdblockSyntax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdguardTeam%2FVscodeAdblockSyntax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AdguardTeam","download_url":"https://codeload.github.com/AdguardTeam/VscodeAdblockSyntax/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248107349,"owners_count":21048908,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adblock","adblock-plus","adguard","ublock-origin","visual-studio-extension"],"created_at":"2024-08-01T16:02:51.379Z","updated_at":"2025-04-09T20:31:29.581Z","avatar_url":"https://github.com/AdguardTeam.png","language":"TypeScript","readme":"\u003c!-- markdownlint-disable --\u003e\n\u0026nbsp;\n\u003cp align=\"center\"\u003e\n    \u003cimg alt=\"AGLint\" src=\"https://cdn.adguard.com/website/github.com/AGLint/aglint_512x512.png\" width=\"128px\"\u003e\n\u003c/p\u003e\n\u003ch3 align=\"center\"\u003eAdblock Language support for VSCode.\u003c/h3\u003e\n\u003cp align=\"center\"\u003e\n    Supported syntaxes:\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://adguard.com/\"\u003e\u003cimg src=\"https://cdn.adguard.com/website/github.com/AGLint/adg_logo_128x128.png\" width=\"14px\"\u003e AdGuard\u003c/a\u003e |\n    \u003ca href=\"https://github.com/gorhill/uBlock\"\u003e\u003cimg src=\"https://cdn.adguard.com/website/github.com/AGLint/ubo_logo_128x128.png\" width=\"14px\"\u003e uBlock Origin\u003c/a\u003e |\n    \u003ca href=\"https://getadblock.com\"\u003e\u003cimg src=\"https://cdn.adguard.com/website/github.com/AGLint/ab_logo_128x128.png\" width=\"14px\"\u003e AdBlock\u003c/a\u003e |\n    \u003ca href=\"https://adblockplus.org/\"\u003e\u003cimg src=\"https://cdn.adguard.com/website/github.com/AGLint/abp_logo_128x128.png\" width=\"14px\"\u003e Adblock Plus\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://marketplace.visualstudio.com/items?itemName=adguard.adblock\"\u003e\u003cimg src=\"https://img.shields.io/visual-studio-marketplace/v/adguard.adblock?label=VSCode%20Marketplace\" alt=\"Visual Studio Marketplace Version (including pre-releases)\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://open-vsx.org/extension/adguard/adblock\"\u003e\u003cimg src=\"https://img.shields.io/open-vsx/v/adguard/adblock?label=Open%20VSX\" alt=\"Open VSX Version\" \u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/AdguardTeam/VscodeAdblockSyntax/blob/master/LICENSE.md\"\u003e\u003cimg src=\"https://img.shields.io/github/license/AdguardTeam/VscodeAdblockSyntax\" alt=\"License\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/AdguardTeam/VscodeAdblockSyntax/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/AdguardTeam/VscodeAdblockSyntax\" alt=\"Open GitHub Issues\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/AdguardTeam/VscodeAdblockSyntax/pulls\"\u003e\u003cimg src=\"https://img.shields.io/github/issues-pr/AdguardTeam/VscodeAdblockSyntax\" alt=\"Open GitHub Pull Requests\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003c!-- markdownlint-restore --\u003e\n\nTable of Contents:\n\n- [Introduction](#introduction)\n    - [Features](#features)\n        - [Syntax highlighting](#syntax-highlighting)\n        - [AGLint integration (linter)](#aglint-integration-linter)\n        - [Configuration](#configuration)\n        - [GitHub Linguist support](#github-linguist-support)\n    - [Ideas \\\u0026 Questions](#ideas--questions)\n    - [Reporting Issues](#reporting-issues)\n    - [Contributing](#contributing)\n    - [License](#license)\n    - [References](#references)\n\n# Introduction\n\nThis extension adds support for AdGuard, uBlock Origin and Adblock Plus syntaxes to Visual Studio Code, so you can write\nadblock rules in a convenient way. It also provides a linter to check your rules for errors.\n\n**We recommend using this extension if you are working with adblock rules.**\n\nYou can easily install the update from the Visual Studio Marketplace or the Open VSX Registry:\n\n- [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=adguard.adblock)\n- [Open VSX Registry](https://open-vsx.org/extension/adguard/adblock)\n\nHere is a screenshot of the extension in action:\n\n\u003ca href=\"https://cdn.adtidy.org/website/github.com/VscodeAdblockSyntax/screenshot.png\"\u003e\n    \u003cimg src=\"https://cdn.adtidy.org/website/github.com/VscodeAdblockSyntax/screenshot.png\"\n         style=\"max-width: 600px\" /\u003e\n\u003c/a\u003e\n\nGitHub Linguist support is also available, so you can highlight your adblock rules in GitHub repositories. See\n[GitHub Linguist support](#github-linguist-support) for more details. Quick example:\n\n```adblock\n! This is an example rule\nexample.org##.banner\n||example.net/script.js$script,third-party,domain=example.com\n```\n\n## Features\n\nIn this section we will describe the main features of this extension.\n\n### Syntax highlighting\n\nSyntax highlighting is available for AdGuard, uBlock Origin and Adblock Plus syntaxes. Nowadays it is unimaginable to\nwork with code without highlighting, which helps you to distinguish different parts of the code and makes it easier\nto read.\n\n### AGLint integration (linter)\n\nWe integrated [AGLint][aglint] into this extension, that makes it able to check your rules for various issues, such as\ninvalid syntax, invalid domains, invalid / incompatible CSS selectors, unknown / incompatible scriptlets, bad practices,\netc. For more information about AGLint, please refer to its [repository][aglint].\n\nAGLint integration is done in the following way:\n\n1. Extension will search local AGLint installation (if it is installed) and use it for linting. First, it will search\n   for local installation in the current workspace, and if it is not found, it will search for a global installation.\n   This is an ideal behavior, because if you have a local installation, it guarantees that you will use the same version\n   of AGLint, and the results will be the same.\n2. If the extension doesn't find any installation, it will use the bundled version of AGLint, which is included in the\n   extension itself. Usually, it is the latest version of AGLint. The advantage of this approach is that you don't need\n   to install AGLint manually, and you can start using the extension immediately after installation.\n\n\u003e [!WARNING]\n\u003e Please note that the linter is under active development, so it may not work properly for some rules. If you\n\u003e find any issues, please report them [here][aglintissues]. We look forward to your feedback, your help is very\n\u003e important to us!\n\n### Configuration\n\nThis extension provides the following configuration options:\n\n\u003c!--markdownlint-disable MD013--\u003e\n| Option | Description | Default value | Possible values |\n| ------ | ----------- | ------------- | --------------- |\n| `adblock.enableAglint` | Enable or disable AGLint integration. If disabled, only syntax highlighting and other language features will be available. | `true` | `true`, `false` |\n| `adblock.useExternalAglintPackages` | If enabled, extension will search for AGLint installations in the system. If disabled, extension will use its own AGLint installation, which is included in the extension (integrated AGLint bundle). If you have AGLint installed in your system / project, it is recommended to enable this option in order to provide consistent results. | `true` | `true`, `false` |\n| `adblock.packageManager` | Package manager to use for searching global AGLint installations. Set it to your preferred package manager. | `npm` | `npm`, `yarn`, `pnpm` |\n\u003c!--markdownlint-enable MD013--\u003e\n\n### GitHub Linguist support\n\nGitHub supports adblock syntax officially via the [Linguist][linguist] library. Our extension provides a\n[TMLanguage file][tmlanguagefile], which is used by Linguist to highlight adblock rules (VSCode highlight also based on\nthis file). This means that if you have a repository with adblock rules, GitHub can highlight your `.txt` files, if the\nfollowing conditions are met:\n\n- If a `*.txt` file **begins** with an adblock agent (such as `[Adblock Plus 2.0]`, `[AdGuard]`, `[uBlock Origin]`,\n  `[Adblock Plus 2.0; AdGuard]`, etc.), then it will be highlighted as an adblock file automatically. You can find the\n  detection heuristics [here][linguistheur].\n- In any other cases, you can override the language classification by adding the following lines to `.gitattributes`\n  file:\n  ```gitattributes\n  # Override classification for *.txt files, so they are highlighted as adblock files.\n  # - This example will match all *.txt files in the repository, but you can\n  #   customize path(s) to match only specific files, such as /filters/*.txt\n  #   or /filters/*.adblock. See https://git-scm.com/docs/gitattributes for more details.\n  # - By default, Adblock language doesn't show up in the repository's language statistics,\n  #   but adding linguist-detectable will resolve this, so it is recommended to add it.\n  *.txt linguist-language=AdBlock linguist-detectable\n  ```\n  You can find more information about overriding language classification [here][linguistoverride].\n\nIn addition, adblock code blocks can be inserted in markdown files and comments according to the following pattern:\n\n\u003cpre\u003e\n```adblock\n! Example rule\nexample.org##.banner\n```\n\u003c/pre\u003e\n\nwill be rendered as:\n\n```adblock\n! Example rule\nexample.org##.banner\n```\n\n## Ideas \u0026 Questions\n\nIf you have any questions or ideas for new features, please open an issue or a discussion. We will be happy to discuss\nit with you.\n\n## Reporting Issues\n\nIf you found a bug or have a feature request, please report it [here][issues]. Please make sure to include as much\ninformation as possible, including screenshots or example rules.\n\nPlease note that the highlighter issues on GitHub will not be fixed immediately when we update the TMLanguage in this\nrepository. GitHub's highlighter is only updated after Linguist releases. This process happens roughly every quarter.\nBefore release, Linguist maintainers will update all integrated TMLanguage to the latest version. You can find more\ninformation about Linguist's release process [here][linguistrelease].\n\n## Contributing\n\nIf you want to contribute to this project, please read the [CONTRIBUTING][contributing] file.\n\n## License\n\nThis extension is licensed under the MIT License. See the [LICENSE][license] file for details.\n\n## References\n\nHere are some useful links to help you write adblock rules. This list is not exhaustive, so if you know any other useful\nresources, please let us know.\n\n\u003c!--markdownlint-disable MD013--\u003e\n- Syntax documentation:\n    - \u003cimg src=\"https://cdn.adguard.com/website/github.com/AGLint/adg_logo_128x128.png\" width=\"14px\"\u003e [AdGuard: *How to create your own ad filters*][adg-filters]\n    - \u003cimg src=\"https://cdn.adguard.com/website/github.com/AGLint/ubo_logo_128x128.png\" width=\"14px\"\u003e [uBlock Origin: *Static filter syntax*][ubo-filters]\n    - \u003cimg src=\"https://cdn.adguard.com/website/github.com/AGLint/abp_logo_128x128.png\" width=\"14px\"\u003e [Adblock Plus: *How to write filters*][abp-filters]\n- Extended CSS documentation:\n    - [MDN: *CSS selectors*][mdn-css-selectors]\n    - \u003cimg src=\"https://cdn.adguard.com/website/github.com/AGLint/adg_logo_128x128.png\" width=\"14px\"\u003e [AdGuard: *Extended CSS capabilities*][adg-ext-css]\n    - \u003cimg src=\"https://cdn.adguard.com/website/github.com/AGLint/ubo_logo_128x128.png\" width=\"14px\"\u003e [uBlock Origin: *Procedural cosmetic filters*][ubo-procedural]\n    - \u003cimg src=\"https://cdn.adguard.com/website/github.com/AGLint/abp_logo_128x128.png\" width=\"14px\"\u003e [Adblock Plus: *Extended CSS selectors*][abp-ext-css]\n- Scriptlets:\n    - \u003cimg src=\"https://cdn.adguard.com/website/github.com/AGLint/adg_logo_128x128.png\" width=\"14px\"\u003e [AdGuard scriptlets][adg-scriptlets]\n    - \u003cimg src=\"https://cdn.adguard.com/website/github.com/AGLint/ubo_logo_128x128.png\" width=\"14px\"\u003e [uBlock Origin scriptlets][ubo-scriptlets]\n    - \u003cimg src=\"https://cdn.adguard.com/website/github.com/AGLint/abp_logo_128x128.png\" width=\"14px\"\u003e [Adblock Plus snippets][abp-snippets]\n- Third party libraries:\n    - [CSSTree docs][css-tree-docs]\n- \u003cimg src=\"https://cdn.adguard.com/website/github.com/AGLint/adg_logo_128x128.png\" width=\"14px\"\u003e [AdGuard's compatibility table][adg-compatibility-table]\n\u003c!--markdownlint-enable MD013--\u003e\n\n[abp-ext-css]: https://help.eyeo.com/adblockplus/how-to-write-filters#elemhide-emulation\n[abp-filters]: https://help.eyeo.com/adblockplus/how-to-write-filters\n[abp-snippets]: https://help.eyeo.com/adblockplus/snippet-filters-tutorial#snippets-ref\n[adg-compatibility-table]: https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/compatibility-table.md\n[adg-ext-css]: https://github.com/AdguardTeam/ExtendedCss/blob/master/README.md\n[adg-filters]: https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters\n[adg-scriptlets]: https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#scriptlets\n[aglint]: https://github.com/AdguardTeam/AGLint\n[aglintissues]: https://github.com/AdguardTeam/AGLint/issues\n[contributing]: https://github.com/AdguardTeam/VscodeAdblockSyntax/blob/master/CONTRIBUTING.md\n[css-tree-docs]: https://github.com/csstree/csstree/tree/master/docs\n[issues]: https://github.com/AdguardTeam/VscodeAdblockSyntax/issues\n[license]: https://github.com/AdguardTeam/VscodeAdblockSyntax/blob/master/LICENSE.md\n[linguist]: https://github.com/github/linguist\n[linguistheur]: https://github.com/github/linguist/blob/c1c34e5260797b4d598f5ec76f19723bfc5a1894/lib/linguist/heuristics.yml#L708-L728\n[linguistoverride]: https://github.com/github/linguist/blob/master/docs/overrides.md\n[linguistrelease]: https://github.com/github/linguist/blob/master/docs/releasing.md\n[mdn-css-selectors]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors\n[tmlanguagefile]: https://github.com/AdguardTeam/VscodeAdblockSyntax/blob/master/syntaxes/adblock.tmLanguage.json\n[ubo-filters]: https://github.com/gorhill/uBlock/wiki/Static-filter-syntax\n[ubo-procedural]: https://github.com/gorhill/uBlock/wiki/Procedural-cosmetic-filters\n[ubo-scriptlets]: https://github.com/gorhill/uBlock/wiki/Resources-Library#available-general-purpose-scriptlets\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAdguardTeam%2FVscodeAdblockSyntax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAdguardTeam%2FVscodeAdblockSyntax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAdguardTeam%2FVscodeAdblockSyntax/lists"}