Skip to content

Commit

Permalink
Improve AGTree markdowns
Browse files Browse the repository at this point in the history
Merge in ADGUARD-FILTERS/tsurlfilter from fix/improve-agtree-markdowns to master

Squashed commit of the following:

commit da4ef90
Author: scripthunter7 <[email protected]>
Date:   Fri Aug 11 13:44:33 2023 +0200

    Format markdown files

commit 89d6777
Author: scripthunter7 <[email protected]>
Date:   Fri Aug 11 13:43:53 2023 +0200

    Update markdownlint config
  • Loading branch information
scripthunter7 committed Aug 11, 2023
1 parent 7ab0a54 commit d249887
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 179 deletions.
3 changes: 2 additions & 1 deletion packages/agtree/.markdownlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"no-duplicate-header": { "siblings_only": true },
"no-blanks-blockquote": false,
"no-bare-urls": false,
"ul-style": { "style": "dash" }
"ul-style": { "style": "dash" },
"emphasis-style": { "style": "asterisk" }
}
9 changes: 4 additions & 5 deletions packages/agtree/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog][keepachangelog], and this project
adheres to [Semantic Versioning][semver].

[keepachangelog]: https://keepachangelog.com/en/1.0.0/
[semver]: https://semver.org/spec/v2.0.0.html
The format is based on [Keep a Changelog][keepachangelog], and this project adheres to [Semantic Versioning][semver].

## [1.1.0] - 2023-08-10

Expand Down Expand Up @@ -39,3 +35,6 @@ adheres to [Semantic Versioning][semver].
### Added

- Migrated parser from AGLint to a separate package.

[keepachangelog]: https://keepachangelog.com/en/1.0.0/
[semver]: https://semver.org/spec/v2.0.0.html
92 changes: 35 additions & 57 deletions packages/agtree/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,90 +1,68 @@
# Contributing

You can contribute to the project by opening a pull request. People who
contribute to AdGuard projects can receive various rewards, see
[this page][contribute] for details.

[contribute]: https://adguard.com/contribute.html
You can contribute to the project by opening a pull request. People who contribute to AdGuard projects can receive
various rewards, see [this page][contribute] for details.

## Development & Contribution

Here is a guide on how to set up the development environment and how to
submit your changes:
Here is a guide on how to set up the development environment and how to submit your changes:

- Pre-requisites: [Node.js][nodejs] (v14 or higher), [Yarn][yarn] (v2 or
higher), [Git][git]. It is important to use Yarn and not NPM, because the
project is optimized for Yarn.
- Fork the repository on GitHub. You will need to have a GitHub account for
this. If you already have a fork, make sure to update it with the latest
changes from the main repository.
- Clone *your forked repository* to your local machine with
`git clone <repository-url>`. It is important to clone your forked repository
and not the main repository, because you will not be able to push your
changes to the main repository, since you do not have the permissions to do
so.
- Pre-requisites: [Node.js][nodejs] (v14 or higher), [Yarn][yarn] (v2 or higher), [Git][git]. It is important to use
Yarn and not NPM, because the project is optimized for Yarn.
- Fork the repository on GitHub. You will need to have a GitHub account for this. If you already have a fork, make sure
to update it with the latest changes from the main repository.
- Clone *your forked repository* to your local machine with `git clone <repository-url>`. It is important to clone your
forked repository and not the main repository, because you will not be able to push your changes to the main
repository, since you do not have the permissions to do so.
- Install dependencies by following [this guide][main-dev-guide].
- Create a new branch with `git checkout -b <branch-name>`. Example:
`git checkout -b feature/add-some-feature`. Please add `feature/` or `fix/`
prefix to your branch name, and refer to the issue number if there is one.
Example: `fix/42`.
- Create a new branch with `git checkout -b <branch-name>`. Example: `git checkout -b feature/add-some-feature`. Please
add `feature/` or `fix/` prefix to your branch name, and refer to the issue number if there is one. Example: `fix/42`.
- Open the **project root** folder in your editor.
- Make your changes and test them.
- Check code by running `yarn check-types`, `yarn lint` and `yarn test`
commands (Husky will run these commands automatically before each commit).
- If everything is OK, commit your changes and push them to your forked
repository. Example:
- Check code by running `yarn check-types`, `yarn lint` and `yarn test` commands (Husky will run these commands
automatically before each commit).
- If everything is OK, commit your changes and push them to your forked repository. Example:
- Add files to commit with `git add .`
- Commit files with `git commit -m "Add some feature"`
- Push changes to your forked repository with
`git push origin feature/add-some-feature`.
- When you are ready to submit your changes, go to your forked repository on
GitHub and create a pull request. Make sure to select the correct branch.
Example: `feature/add-some-feature` branch in your forked repository to
`master` branch in the main repository.
- After you open a pull request, GitHub Actions will run the tests on your
changes. If the tests fail, you can see the error details in the "Checks"
tab. If the tests pass, a green checkmark will appear in the "Checks" tab.
- Finally, wait for the maintainers to review your changes. If there are any
issues, you can fix them by pushing new commits to your branch. If everything
is OK, the maintainers will merge your pull request.

We would be happy to review your pull request and merge it if it is suitable for
the project.
- When you are ready to submit your changes, go to your forked repository on GitHub and create a pull request. Make sure
to select the correct branch. Example: `feature/add-some-feature` branch in your forked repository to `master` branch
in the main repository.
- After you open a pull request, GitHub Actions will run the tests on your changes. If the tests fail, you can see the
error details in the "Checks" tab. If the tests pass, a green checkmark will appear in the "Checks" tab.
- Finally, wait for the maintainers to review your changes. If there are any issues, you can fix them by pushing new
commits to your branch. If everything is OK, the maintainers will merge your pull request.

[git]: https://git-scm.com/
[main-dev-guide]: https://github.com/AdguardTeam/tsurlfilter#development
[nodejs]: https://nodejs.org/en/
[yarn]: https://yarnpkg.com/
We would be happy to review your pull request and merge it if it is suitable for the project.

### Available commands

During development, you can use the following commands (listed in
`package.json`):
During development, you can use the following commands (listed in `package.json`):

- `yarn build` - builds the library with [rollup][rollup] to the `dist` folder
- `yarn build-txt` - creates a `dist/build.txt` file which contains the version
of the library.
- `yarn build-types` - build type definitions with [TypeScript][typescript] to
the `dist/types` folder.
- `yarn check-compatibility-tables` - checks if the
[compatibility tables][compatibility-tables] are valid.
- `yarn check-types` - check type definitions with
[TypeScript][typescript].
- `yarn build-txt` - creates a `dist/build.txt` file which contains the version of the library.
- `yarn build-types` - build type definitions with [TypeScript][typescript] to the `dist/types` folder.
- `yarn check-compatibility-tables` - checks if the [compatibility tables][compatibility-tables] are valid.
- `yarn check-types` - check type definitions with [TypeScript][typescript].
- `yarn clean` - remove the `dist` folder.
- `yarn clean-types` - remove the `dist/types` folder.
- `yarn coverage` - run tests with [Jest][jest] and generate a code coverage
report.
- `yarn increment` - increment the version of the library in `package.json`
(patch version by default).
- `yarn coverage` - run tests with [Jest][jest] and generate a code coverage report.
- `yarn increment` - increment the version of the library in `package.json` (patch version by default).
- `yarn lint` - run all linters.
- `yarn lint:md` - lint the markdown files with [markdownlint][markdownlint].
- `yarn lint:ts` - lint the code with [ESLint][eslint].
- `yarn precommit` - run all checks before committing.
- `yarn test` - run tests with [Jest][jest].

[compatibility-tables]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/src/compatibility-tables
[contribute]: https://adguard.com/contribute.html
[eslint]: https://eslint.org/
[git]: https://git-scm.com/
[jest]: https://jestjs.io/
[main-dev-guide]: https://github.com/AdguardTeam/tsurlfilter#development
[markdownlint]: markdownlint
[nodejs]: https://nodejs.org/en/
[rollup]: https://rollupjs.org/
[typescript]: https://www.typescriptlang.org/
[yarn]: https://yarnpkg.com/
78 changes: 24 additions & 54 deletions packages/agtree/README.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,34 @@
<!-- markdownlint-disable -->

&nbsp;

<p align="center">
<picture>
<source
media="(prefers-color-scheme: dark)"
srcset="https://cdn.adtidy.org/website/github.com/AGTree/agtree_darkmode.svg"
/>
<img
alt="AGTree"
src="https://cdn.adtidy.org/website/github.com/AGTree/agtree_lightmode.svg"
width="350px"
/>
<source media="(prefers-color-scheme: dark)" srcset="https://cdn.adtidy.org/website/github.com/AGTree/agtree_darkmode.svg" />
<img alt="AGTree" src="https://cdn.adtidy.org/website/github.com/AGTree/agtree_lightmode.svg" width="350px" />
</picture>
</p>
<h3 align="center">Universal adblock filter list parser</h3>
<p align="center">Supported syntaxes:</p>
<p align="center">
<a href="https://adguard.com">
<img
src="https://cdn.adguard.com/website/github.com/AGLint/adg_logo.svg"
width="14px"
/>
<img src="https://cdn.adguard.com/website/github.com/AGLint/adg_logo.svg" width="14px" />
AdGuard
</a>
|
<a href="https://github.com/gorhill/uBlock">
<img
src="https://cdn.adguard.com/website/github.com/AGLint/ubo_logo.svg"
width="14px"
/>
<img src="https://cdn.adguard.com/website/github.com/AGLint/ubo_logo.svg" width="14px" />
uBlock Origin
</a>
|
<a href="https://getadblock.com">
<img
src="https://cdn.adguard.com/website/github.com/AGLint/ab_logo.svg"
width="14px"
/>
<img src="https://cdn.adguard.com/website/github.com/AGLint/ab_logo.svg" width="14px" />
AdBlock
</a>
|
<a href="https://adblockplus.org">
<img
src="https://cdn.adguard.com/website/github.com/AGLint/abp_logo.svg"
width="14px"
/>
<img src="https://cdn.adguard.com/website/github.com/AGLint/abp_logo.svg" width="14px" />
Adblock Plus
</a>
</p>

<p align="center">
<a href="https://www.npmjs.com/package/@adguard/agtree">
<img src="https://img.shields.io/npm/v/@adguard/agtree" alt="NPM version" />
Expand All @@ -74,8 +52,7 @@ Table of Contents:

## Introduction

AGTree is a universal tool for working with adblock filter lists. It contains
the following modules:
AGTree is a universal tool for working with adblock filter lists. It contains the following modules:

- [Adblock rule converter][converter-url]
- [Adblock rule parser][parser-url]
Expand All @@ -88,41 +65,23 @@ AGTree supports all syntaxes currently in use:
- <img src="https://cdn.adguard.com/website/github.com/AGLint/abp_logo.svg" width="14px"> [Adblock Plus][abp-url]
- <img src="https://cdn.adguard.com/website/github.com/AGLint/ab_logo.svg" width="14px"> [AdBlock][ab-url]

[ab-url]: https://getadblock.com
[abp-url]: https://adblockplus.org
[adg-url]: https://adguard.com
[compatibility-tables-url]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/src/compatibility-tables
[converter-url]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/src/converter
[parser-url]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/src/parser
[ubo-url]: https://github.com/gorhill/uBlock

## Development & Contribution

Please read the [CONTRIBUTING.md][contributing-url] file for details on how to
contribute to this project.

[contributing-url]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/CONTRIBUTING.md
Please read the [CONTRIBUTING.md][contributing-url] file for details on how to contribute to this project.

## Ideas & Questions

If you have any questions or ideas for new features, please
[open an issue][new-issue-url] or a [discussion][discussions-url]. We will be
happy to discuss it with you.

[discussions-url]: https://github.com/AdguardTeam/tsurlfilter/discussions
[new-issue-url]: https://github.com/AdguardTeam/tsurlfilter/issues/new
If you have any questions or ideas for new features, please [open an issue][new-issue-url] or a
[discussion][discussions-url]. We will be happy to discuss it with you.

## License

AGTree is licensed under the MIT License. See the [LICENSE][license-url] file
for details.

[license-url]: https://github.com/AdguardTeam/tsurlfilter/blob/master/packages/agtree/LICENSE
AGTree is licensed under the MIT License. See the [LICENSE][license-url] file for details.

## References

Here are some useful links to help you write adblock rules. This list is not
exhaustive, so if you know any other useful resources, please let us know.
Here are some useful links to help you write adblock rules. This list is not exhaustive, so if you know any other useful
resources, please let us know.

<!--markdownlint-disable MD013-->
- Syntax documentation:
Expand All @@ -143,15 +102,26 @@ exhaustive, so if you know any other useful resources, please let us know.
- <img src="https://cdn.adguard.com/website/github.com/AGLint/adg_logo.svg" width="14px"> [AdGuard's compatibility table][adg-compatibility-table]
<!--markdownlint-enable MD013-->

[ab-url]: https://getadblock.com
[abp-ext-css]: https://help.eyeo.com/adblockplus/how-to-write-filters#elemhide-emulation
[abp-filters]: https://help.eyeo.com/adblockplus/how-to-write-filters
[abp-snippets]: https://help.eyeo.com/adblockplus/snippet-filters-tutorial#snippets-ref
[abp-url]: https://adblockplus.org
[adg-compatibility-table]: https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/compatibility-table.md
[adg-ext-css]: https://github.com/AdguardTeam/ExtendedCss/blob/master/README.md
[adg-filters]: https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters
[adg-scriptlets]: https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#scriptlets
[adg-url]: https://adguard.com
[compatibility-tables-url]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/src/compatibility-tables
[contributing-url]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/CONTRIBUTING.md
[converter-url]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/src/converter
[css-tree-docs]: https://github.com/csstree/csstree/tree/master/docs
[discussions-url]: https://github.com/AdguardTeam/tsurlfilter/discussions
[license-url]: https://github.com/AdguardTeam/tsurlfilter/blob/master/packages/agtree/LICENSE
[mdn-css-selectors]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors
[new-issue-url]: https://github.com/AdguardTeam/tsurlfilter/issues/new
[parser-url]: https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree/src/parser
[ubo-filters]: https://github.com/gorhill/uBlock/wiki/Static-filter-syntax
[ubo-procedural]: https://github.com/gorhill/uBlock/wiki/Procedural-cosmetic-filters
[ubo-scriptlets]: https://github.com/gorhill/uBlock/wiki/Resources-Library#available-general-purpose-scriptlets
[ubo-url]: https://github.com/gorhill/uBlock
4 changes: 2 additions & 2 deletions packages/agtree/src/compatibility-tables/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
- [ ] Import scriptlets/redirects from AdGuard Scriptlets library? GitHub Action for importing?
- [ ] GitHub Action workflow that checks YML files for errors.
- [ ] Finalize table structure, if needed. It depends on edge cases and how we'll use the tables in the API.
- [ ] Table optimization, if needed. We need a maintainable, convenient data structure for the tables,
so maybe we'll need to optimize it before using it in the API.
- [ ] Table optimization, if needed. We need a maintainable, convenient data structure for the tables, so maybe we'll
need to optimize it before using it in the API.
- [ ] Create API endpoints for the tables.
- [ ] Wiki generation (`.md` files from the tables / gh-pages).

Expand Down
14 changes: 7 additions & 7 deletions packages/agtree/src/compatibility-tables/modifiers/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Modifiers compatibility tables

Each file represents a specific modifier. The file name is the name of the modifier.
For example, `third-party` is represented by the file `third-party.yml`.
Each file represents a specific modifier. The file name is the name of the modifier. For example, `third-party` is
represented by the file `third-party.yml`.

## File structure

Each file contains an object,
where the key is the [actual adblocker ID](../README.md#supported-adblockers-and-platforms)
and the value is the object with the following fields:
Each file contains an object, where the key is the
[actual adblocker ID](../README.md#supported-adblockers-and-platforms) and the value is the object with the following
fields:

<!-- markdownlint-disable MD013 -->
| Field | Description | Type | Default value [**] |
Expand All @@ -18,9 +18,9 @@ and the value is the object with the following fields:
| `docs` | Link to the documentation. If not specified or it's value is `null`, then the documentation is not available. | `string\|null` | `null` |
| `version_added` | The version of the adblocker when the modifier was added. | `string\|null` | `null` |
| `version_removed` | The version of the adblocker when the modifier was removed. | `string\|null` | `null` |
| `deprecated` | Describes whether the modifier is deprecated; for _soon-to-be removed_ features. | `boolean` | `false` |
| `deprecated` | Describes whether the modifier is deprecated; for *soon-to-be removed* features. | `boolean` | `false` |
| `deprecation_message` | Message that describes why the modifier is deprecated. If not specified or it's value is `null`, then the message is not available. It's value is omitted if the scriptlet is not marked as deprecated. | `string\|null` | `null` |
| `removed` | Describes whether the modifier is removed; for _already removed_ features. | `boolean` | `false` |
| `removed` | Describes whether the modifier is removed; for *already removed* features. | `boolean` | `false` |
| `removal_message` | Message that describes why the modifier is removed. If not specified or it's value is `null`, then the message is not available. It's value is omitted if the scriptlet is not marked as deprecated. | `string\|null` | `null` |
| `conflicts` | List of modifiers that are incompatible with the actual one. | `string[]\|null` | `null` (no conflicts) |
| `inverse_conflicts` | The actual modifier is incompatible with all other modifiers, except the ones listed in `conflicts`. | `boolean` | `false` |
Expand Down
Loading

0 comments on commit d249887

Please sign in to comment.